Commit Graph

187 Commits

Author SHA1 Message Date
Andreas Jaeger b4689abeda Retire repo
This repo was created by accident, use deb-python-os-apply-config
instead.

Change-Id: I81894aea69b9d09b0977039623c26781093a397a
2017-04-17 18:38:03 +02:00
OpenStack Proposal Bot 69879dad8b Updated from global requirements
Change-Id: I58e3e4c53dc7bbce3340c7a6b14dd88f1e99e526
2016-06-21 18:03:58 +00:00
OpenStack Proposal Bot 3af31b4967 Updated from global requirements
Change-Id: Ie061d116de4b8f6332783ae875f324c5eb165bef
2016-06-02 21:10:05 +00:00
OpenStack Proposal Bot 36f24df3e7 Updated from global requirements
Change-Id: Ieb1dbbfd189eec97467aff54e01ae9c09042fc0e
2016-05-30 20:44:33 +00:00
OpenStack Proposal Bot a23d5c721b Updated from global requirements
Change-Id: I17aedeeed010e73ebaaa58387c5d81e9a45113ab
2016-05-30 00:37:51 +00:00
OpenStack Proposal Bot 85be7e2fa7 Updated from global requirements
Change-Id: I26b9fefd0ac8aa2526659f13487d9c3af3d167c3
2016-04-08 00:31:35 +00:00
OpenStack Proposal Bot a023519047 Updated from global requirements
Change-Id: I394f30a90fa185a14a0cff8427906b38158f036b
2016-02-25 01:51:41 +00:00
Jenkins 2e4362d639 Merge "Deprecated tox -downloadcache option removed" 2016-02-24 22:55:23 +00:00
Andreas Jaeger 61712212b9 Remove argparse from requirements
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
2016-01-20 19:18:10 +01:00
Ondřej Nový 45ca3ce020 Deprecated tox -downloadcache option removed
Caching is enabled by default from pip version 6.0

More info:
https://testrun.org/tox/latest/config.html#confval-downloadcache=path
https://pip.pypa.io/en/stable/reference/pip_install/#caching

Change-Id: Ieefd14c646ccb53c16f175cfd5b60ae1e8d410c7
2015-12-11 23:17:40 +01:00
Jenkins 00e6302fce Merge "Change ignore-errors to ignore_errors" 2015-09-25 20:16:40 +00:00
Monty Taylor 393bb1f784 Change ignore-errors to ignore_errors
Needed for coverage 4.0

Change-Id: I41e76f02605020422cd850c0d91417e1746379bd
2015-09-21 14:41:25 +00:00
OpenStack Proposal Bot 0f3f8b85c3 Updated from global requirements
Change-Id: I484f45a51647d39a1017b0d7c092aaa472d88478
2015-09-17 12:15:37 +00:00
OpenStack Proposal Bot 2e0a2f6d8e Updated from global requirements
Change-Id: I536332746c57aa261f830f5b6734b191623e84af
2015-05-07 23:36:18 +00:00
OpenStack Proposal Bot 6e0912542b Updated from global requirements
Change-Id: I639678dfb56fb07dc0a60f8f97b54e76f7fc7ba5
2015-03-03 11:01:43 +00:00
Jenkins 752646a4ba Merge "Log warning when --boolean-key and --key are used" 2015-03-03 08:37:44 +00:00
Steve Baker 94f9819c67 Ignore top-level merge items which evaluate False
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
2015-02-27 09:45:39 +13:00
Jenkins 9d70d50ff3 Merge "Print JSON-compatible booleans" 2015-02-19 22:41:56 +00:00
Clint Byrum 59586b393f Log warning when --boolean-key and --key are used
These are not compatible, so log a warning when they're used together.

Change-Id: I8e72f90f9e789c413cba2e95543313c4a7bf95a3
2015-02-11 17:13:00 -08:00
Alexis Lee 1c17f543be Print JSON-compatible booleans
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
2015-01-22 09:48:32 +00:00
Clint Byrum 92a9d5d011 Add --boolean-key for evaluating boolean keys
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
2015-01-14 12:53:56 -08:00
Dan Prince fcb3d0f96f Output useful JSON data
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
2014-12-16 16:54:03 +00:00
OpenStack Proposal Bot b4c5ee5995 Updated from global requirements
Change-Id: Ib99e024114239ae8abecf1425028aaf61a1ad704
2014-11-20 14:11:08 +00:00
OpenStack Proposal Bot 40eda28088 Updated from global requirements
Change-Id: I0c5fe8001eb377c3359f73b97131293fadd57171
2014-11-18 11:35:56 +00:00
OpenStack Proposal Bot f3d0a1d376 Updated from global requirements
Change-Id: I1cf6522ca502b4cbc295403342e90882b3bd26e2
2014-11-16 15:05:54 +00:00
OpenStack Proposal Bot a23fa71019 Updated from global requirements
Change-Id: Ia0aca6b3e7d1797dcca6da36889196a50acc57ea
2014-11-05 08:34:38 +00:00
Jenkins 29db0f43e8 Merge "Treat null values in JSON as being absent rather than 'None'" 2014-10-30 17:33:35 +00:00
Jenkins 312d741eaf Merge "Set owner+group from control file" 2014-10-24 09:34:30 +00:00
Jenkins 9d11d4d0a5 Merge "Allow extraction of list items" 2014-10-24 09:01:43 +00:00
Alexis Lee b541159d27 Allow extraction of list items
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
2014-10-21 11:31:35 +01:00
Alexis Lee bfef75d33f Set owner+group from control file
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
2014-10-21 09:59:19 +00:00
Alexis Lee ce14b9a4c3 Extract OacFile class to separate file
Change-Id: I97448fe2b503314398db5928ec6a3bbfffe6b2be
2014-10-21 09:59:12 +00:00
Jonathan Brownell e78b8d6964 Treat null values in JSON as being absent rather than 'None'
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
2014-10-17 14:31:50 -07:00
OpenStack Proposal Bot 43c5d433ec Updated from global requirements
Change-Id: I201c1593fc12cd2cac3db30e35483320cf0ed663
2014-10-11 15:55:47 +00:00
Jenkins ef971cd603 Merge "Updated from global requirements" 2014-09-29 10:39:33 +00:00
Jenkins 8b9d56f3eb Merge "Add mode to metadata header" 2014-09-29 10:39:27 +00:00
OpenStack Proposal Bot c88b7c8628 Updated from global requirements
Change-Id: I3fb3dce4ed2c8d6e8020888caa0adb22a316bae2
2014-09-19 08:50:39 +00:00
Jenkins b1e5148315 Merge "Modify gitignore to ignore cover" 2014-09-16 20:04:30 +00:00
Alexis Lee 638d62518e Add mode to metadata header
-- 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
2014-09-15 13:02:06 +01:00
Jenkins 0d39cd5e11 Merge "Support control files" 2014-09-15 06:45:39 +00:00
Motohiro OTSUKA 31b31d5115 Modify gitignore to ignore cover
Prevent generated coverage report files from being imported.

Change-Id: Id804a2a69e5f6830c7ce1fc5537c8470eafb85e5
2014-09-12 15:53:04 +09:00
Alexis Lee 6158268631 Support control files
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
2014-09-10 15:25:55 +01:00
Clark Boylan 4ae6efd726 Support py34 tox target.
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
2014-09-09 11:03:59 -07:00
Steve Kowalik 117e7c0f77 Support for Python 3
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
2014-08-21 17:05:53 +10:00
Christian Berendt 3685add131 Bump hacking to 0.9.x series
Change-Id: Ic55dc90c2ce147ada45946ca2dd246c310d8e7f6
2014-07-21 09:43:19 +02:00
OpenStack Proposal Bot f300bd39b5 Updated from global requirements
Change-Id: Ib38f89fab93355b9f0c37e048b1980d4b7fb522b
2014-06-20 03:38:03 +00:00
Clint Byrum e061e33490 Fix coverage report generation
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
2014-06-03 11:06:39 -07:00
OpenStack Proposal Bot c4b64899e3 Updated from global requirements
Change-Id: Ie61f01cff77498039bb050f4e70b74622e527e20
2014-05-29 13:46:13 +00:00
Coleman Corrigan e3aa1631c1 Fix for string key traversal bug #1321827
Gracefully handle the traversal of strings in a key search path.

Closes-Bug: #1321827

Change-Id: I1fab13905fc1f6ed2817081d58fcc5379f2a8515
2014-05-27 11:24:42 +01:00
Jenkins 6e9aa57e13 Merge "Use FHS-compliant default template location" 2014-05-02 09:35:43 +00:00