The use case for --print is an administrator wanting to view the
metadata that os-collect-config sees without running any commands.
Fixes bug #1213195
This is a useful debugging and/or system fixer tool for instances where
metadata has not changed but one needs to re-run the configuration.
Fixes bug #1223693
Keep a hash of the config file for os-collect-config and if it changes
during a failed run then rerun immediately(without sleep), effectively
causing new nodes to be ready 5 minutes earlier.
Because the cfn credentials are placed into os-collect-config.conf by
os-apply-config and are not in place the first time os-collect-config is
run, the first run of os-collect-config results in error, o-c-c then
sleeps for 5 minutes before running successfully the second time.
Fixes bug #1219186
On a system with o-c-c installed by pip the binary generated by PBR
calls __main__() directly, the code that sets up logging sould be placed
here otherwise it will be bypassed. Resulting in missing log messages.
The point of delaying the commit of data to the cache is that we want to
make sure the command succeeds before giving up on the data changes.
This will ensure that we keep trying the command with any given change
to the metadata until it succeeds.
Smart hooks may want to perform delta analysis on metadata, and tests
want to be able to tell if the cache is updated it's previous state,
so we should make the presence and name of the old versions of the
files a stable interface.
Heat does not give us the exact API version to request, so we must infer
version 1 (/v1/) since that is what we speak. The other test cases are
all updated to use /v1/ too, so that the fakes can remain the same.
If a source always fails to read, but others succeeded, the ensuing
commit of all collectors results in an unhandled IOError coming from
shutil.copy. However, commit on an uncollected source should just
be a noop, as there is nothing to commit.
After we have run a command and committed, re-execute ourselves. This
ensures that we will get any configurations that may have come from
underlying commands. Also re-execute if os-collect-config is sent HUP.
Heat passes this in via cloud-init to assist heat-cfntools in finding the
cfn metadata server url. This will likely be the primary location used,
and cfn.metadata_url will be an override.
Also doing some cleanup, removed unused cfn.EC2_METADATA_URL and
reordered and regrouped imports.
This makes os-collect-config stay resident and prepares it for a more
event based operation when the Heat API is ready for that via longpoll
or callbacks or something else.
setup.cfg depends on the README file for its long description, so if
it's not in the source tarball, the build will bomb out. README.rst is an
automatically grokked name of a file for python and gets included
automatically. While we're dealing with this, add a MANIFEST.in to
ensure that AUTHORS and ChangeLog get installed too.
Positional arguments now specify which collectors to use. This allows
disabling a collector if it is problematic, and also re-ordering of the
emitted $OS_CONFIG_FILES from the default order if necessary.