Commit graph

23 commits

Author SHA1 Message Date
Carlos Meza
873ac802e9 use upstream json_minify 2018-02-11 08:29:18 +00:00
Nicolas Braud-Santoni
d8c831a7fa
common.tools: Make rel_path normalize the path 2016-09-12 18:15:56 +02:00
Nicolas Braud-Santoni
734afd892b
common.tools: Add a function for relative pathes
rel_path(a, b) is the absolute path of b, taken relative to a.
If b is already an absolute path, rel_path(a, b) is b.
2016-09-12 17:37:44 +02:00
Anders Ingemann
f62c8ade99 Convert indentation from tabs to spaces (4)
Up until now I didn't see the point of using spaces for indentation.
However, the previous commit (a18bec3) was quite eye opening.
Given that python is an indentation aware language, the amount of
mistakes that went unnoticed because tabs and spaces were used
at the same time (tabs for indentation and spaces for alignment)
were unacceptable.

E101,W191 have been re-enable in the tox flake8 checker and
the documentation has been modified accordingly.

The following files have been left as-is:
* bootstrapvz/common/assets/extlinux/extlinux.conf
* bootstrapvz/common/assets/init.d/expand-root
* bootstrapvz/common/assets/init.d/generate-ssh-hostkeys
* bootstrapvz/common/assets/init.d/squeeze/generate-ssh-hostkeys
* bootstrapvz/plugins/docker_daemon/assets/init.d/docker
* bootstrapvz/providers/ec2/assets/bin/growpart
* bootstrapvz/providers/ec2/assets/grub.d/40_custom
* bootstrapvz/providers/ec2/assets/init.d/ec2-get-credentials
* bootstrapvz/providers/ec2/assets/init.d/ec2-run-user-data
* docs/_static/taskoverview.coffee
* docs/_static/taskoverview.less
* tests/unit/subprocess.sh
2016-06-04 11:38:16 +02:00
Anders Ingemann
71c7d445ad Fix #217, by introducing class for comparison of releases 2015-04-29 21:38:06 +02:00
Anders Ingemann
ec96de3a0e fix log_call logging when command is a string 2015-04-16 22:21:46 +02:00
Anders Ingemann
d26ba8bea4 Simplify exception throwing in sed_i 2015-04-16 22:21:46 +02:00
Anders Ingemann
f63d3c73aa Use subn to count the actual replacements done in inline_replace() 2015-04-16 22:21:46 +02:00
Anders Ingemann
e9a3845281 Fix serialization of CalledProcessError 2015-04-16 22:21:45 +02:00
Anders Ingemann
200c5086e5 Extend sed_i to raise Exceptions when the expected amount of replacements is not met 2015-04-16 22:15:21 +02:00
Anders Ingemann
e41dbdd807 Rename variable in load_yaml to match load_json 2014-07-16 22:08:13 +02:00
Anders Ingemann
34bb45bb00 Factor release codename fetching out into common.tools
This allows code that runs before the bootstrapinformation object has been created
to also figure out the release codename
2014-07-09 23:17:05 +02:00
Anders Ingemann
03a0746299 Convert every JSON file to YAML
Lines removed: over 500. Readiblity gained: A shitload
Now you can actually get an overview of a manifest on a single screen height.
I am sure that it will also save a lot of hassle when modifying schema in the future.
No more "expected property name" etc. because of an extraneous comma
Comments are of course natively support, so there's no need for this minify_json hokey pokey
2014-07-09 23:17:04 +02:00
Jimmy Kaplowitz
19240dc201 Support executing commands in a specific cwd
Simply plumbed through to Popen(), which already supports this.

Change-Id: If1fdf0a33c96f3aad42407fdc7c9c9f7d4b95c00
2014-06-19 17:16:39 -07:00
Anders Ingemann
f1994fab1e Don't use Queue to gather log messages in log_call
... instead we just log the messages directly
2014-05-04 14:36:43 +02:00
Anders Ingemann
f3d633780f Use string concatenation instead of format()
String concatenation can at times be easier to read that format().
One should choose whichever approach is more readable.
2014-05-04 13:41:15 +02:00
Anders Ingemann
858e325fac Fix minor mistakes in log_call 2014-05-03 23:15:10 +02:00
Anders Ingemann
00780844c7 Add a test for log_call.
Make log_call a little shorter as well, stream_readline() is now a closure.
2014-05-03 19:41:55 +02:00
Tiago Ilieve
f43f961de3 Add multiple threads to log_call
Conflicts:
	bootstrapvz/common/tools.py
2014-05-03 19:41:07 +02:00
Rory Finnegan
708c3d589e Fixed previous yaml load commit and added a tox.ini file.
DETAILS:
- Apparently a potential security issue with yaml.load vs yaml.safe_load.
  Like pickling, yaml.load could result in arbitrary code being run.
- tox.ini file includes the flake8 settings for this project, build spec for 2.7
  and line for eventually testing the project.
2014-04-15 20:29:01 -05:00
Rory Finnegan
60571f66ad Fixed formatting standards on files I've changed.
Used command `find . -name '*.py' | grep -v minify_json | xargs pep8 --ignore=E101,E221,E241,E501,W191`
2014-04-08 11:56:27 -05:00
Rory Finnegan
4b5c2d8c5f Added YAML config support.
- Manifest format parsing is now checked by the file extension ie: .json, .yml or .yaml.
- load_yaml in common/tools is the same as the json version.
- schema checking of manifest still passes (and fails appropriately) like the json manifests.
- I've also included a sample yaml config based off of the debian test json manifest.
2014-04-08 14:45:12 +00:00
Anders Ingemann
be96e4c13f Move code into proper package folder 2014-04-02 21:26:13 +02:00
Renamed from common/tools.py (Browse further)