argparse was external in python 2.6 but not anymore, remove it from
requirements.
This should help with pip 8.0 that gets confused in this situation.
Installation of the external argparse is not needed.
Change-Id: Ib7e74912b36c1b5ccb514e31fac35efeff57378d
There has been recent tripleo regressions caused by heat
setting empty config as '' rather than {} which cause os-apply-config
to error on merge_configs.
This change ignores any top-level config which evaluates to False,
ignoring possible empty data including '', {}, None, []
An os-apply-config release with this fix would likely allow the current
heat pin to be removed Id134664a5df7232da0fb5d9ed62b82e12b3d54a8
Change-Id: Ia5bd99d1550f43760c064b769be3be46b3417331
Closes-Bug: #1426116
Related-Bug: #1425238
Given os-apply-config takes a JSON file as input and prints JSON-style
strings not Python ones, Booleans present an anomaly.
These are printed using `str(config)`, resulting in "True" and "False"
rather than the lowercase and JSON-compatible "true" and "false". This
patch corrects this.
There is some risk of breaking users but it should be trivial for them
to fix their scripts. As I write this, o-a-c is at 0.1.28, so we're
allowed breaking changes and I believe this is the last change required
to make all output JSON-compatible.
Change-Id: Ib41d3b01656fc7afc4911fd78ba7c1116aa9b1c9
In the past if we wanted to have a boolean key we had to evaluate the
python string representation of the key which is not necessarily very
easy in shell. This allows us to replace this code:
if [ "$(os-apply-config --key x.foo --type raw)" = "True" ] ; then
...
fi
With a much more shell friendly version:
if os-apply-config --boolean-key x.foo; then
...
fi
Change-Id: Ie88663a0028596dbd2a9c25dfc4ce54a46a63e66
If you use os-apply-config to slice out a JSON blob on the command
line you'll get back a string formatted dump of a python
dictionary (or list). Ideally we would print out proper JSON text
so that other tooling (jq, etc) can post process things in a
useful manner.
This patch updates apply_config so that if an output key is
detected to be a dict or a list it is printed to stdout
in a JSON format.
Change-Id: Ibc8b21cd6922b8664ca71e9e6009c8573ea9d107
OAC can be used to get a key from metadata by supplying EG '--key A'.
You can also extract an item from a dict, EG '--key A.B'.
However, if A is a list, there's no way to get an item out of the list.
Extend the expression language (if that's not too grand a term) to
support this. EG '--key A.0' gets the first item out of the list A.
'--key A.1.B' gets B out of the second item of list A (which must be a
dict).
Change-Id: I406cbd2d974544ed5948e137359629184d8ee156
Add keys 'uid' and 'gid' to control file. The values may be UID/GIDs or
names. In either case, the value is checked against the passwd/group
database to ensure it exists.
Change-Id: I1730a126cf024755635043b1a0f70006ab22c046
The current method of serialization for keys containing null
values in JSON input files is that they become a part of the
metadata tree, with a value expressed as the string 'None' in
output (when invoked with --key) or when inserted into templates.
The use of 'None' creates awkward ambiguity (no way for downstream
code logic to tell if the request JSON key originally contained
the string "None" or if it was actually null), and also throws
conversion errors when requested in any type other than 'raw'.
This patch proposes that keys with null values be handled as
though they were absent from the metadata completely. (If
such a key is requested in command-line invokations using "--key"
and "--key-default", the provided default will be printed.)
Change-Id: I9288dffb13d781e0c4dd9e5be0b483c090ec2d7c
-- os-apply-config --
mode: 0644
-- end --
Mode must be an integer in [0, 0777]. Preferably this will be written as
three octal digits. The default is to use the mode of the target file if
it already exists, otherwise 0644.
Advances blueprint oac-header
Change-Id: I3abfee89d418474b3766a97cfc178c02252e2d02
Allow templates to provide a control file (EG foo => foo.oac). The
control file must be a single YAML mapping. Directory control files are
not supported yet.
Provide a single valid key, allow_empty, by way of example. If
allow_empty is false, either the target file will not be created or if
there's already a file in place, it will be deleted.
Add requirement on 'six' library for Python 3.3 compatibility.
Advances blueprint oac-header
See spec I8fe7126d7261c1f106d7413bd31aa379e9ae5c3e
Change-Id: Ic6952688e4f8273885192bcd5eda8cb657f5a940
OpenStack is making a push to move projects that had been tested on py33
to py34 because py34 will have a much larger install base (and is
consequently easier to test).
The python 3.4 json lib returns new and different error strings when
json decoding fails. Remove assertions from test_load_list_from_json
hat check these error strings, instead simply rely on assertRaises to
assert that the appropriate error is thrown.
Change-Id: Ia6603783014b0114de0f29664834d21196744774
Fix up various things to support Python 3. This also included removing
the pretty lines in README.rst, because tox with Python 3 just could
not cope.
Change-Id: I8e8a40ebc54ab781ccf0961a88fd1f8526aaeba0
Previously the coverage report would not be generated as the dashes in
the package name confused it.
We also add a .coveragerc so that the report is generated on just the
code.
Change-Id: I27c0320dca1b3ad26e24d9df09b8f5954e149991