Commit Graph

160 Commits (db896fdf3ac9d8b2034b65c5b8a2dfb6c4f8d69f)

Author SHA1 Message Date
Clint Byrum db896fdf3a Make --version work properly
We have pbr and we have oslo.config. Tell them about eachother.

Change-Id: I65d449b0ed961c824a3e7c1307aab63f73bc03ad
2013-09-17 17:30:52 -07:00
Clint Byrum 635955def4 Add --print option to force printing
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

Change-Id: I0251f2c70574aeaa79997ce822d2a5ffbe08e345
2013-09-16 12:35:25 -07:00
Jenkins f21f986ff4 Merge "Add a --force option" 2013-09-13 16:47:48 +00:00
Monty Taylor 1351034731 Update requirements
Specifically, stop using d2to1

Change-Id: Ie8af1dd5a8519bdb4105f11d94d95ce4e464c95a
2013-09-13 11:17:07 -05:00
Clint Byrum c1e60159f5 Add a --force option
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

Change-Id: I62b097bafa339fefcf6e03d11636f5ab622fb71a
2013-09-13 07:52:58 -07:00
Clint Byrum 6eb8eb9af3 Store list of collected configs in cachedir
This will allow tools like os-apply-config to read the list even when
they are run out of band from os-collect-config.

Change-Id: Ic4eaf649e234f4a1367d20c7ec52e93e787a7bb3
2013-09-13 00:39:49 -07:00
Clint Byrum c2b1b3909c Add --print-cachedir option
The option allows other programs to find the cache directory and files
without having access to OS_CONFIG_FILES.

Change-Id: Iad87efb65ea4db387e94160376c9eaf956fff413
2013-09-13 00:33:14 -07:00
Derek Higgins 61b6dfb604 Replace tearDown with NestedTempfile Fixture
Teardown isn't called if Setup errors, this should be more reliable.

Change-Id: I7804738527b1da18908652cf5dee591d75fa66b5
2013-09-03 20:50:14 +01:00
Derek Higgins 4cfeb28d12 Rerun os-collect-config if config changed
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

Change-Id: I090de7a3d84e0ea342f1a422646c0c455eb37f4a
2013-09-03 13:35:55 +01:00
Derek Higgins bbb1c77106 Setup loghandlers in o-c-c binary
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.

Change-Id: I94ba4f61be9595a6ddee134d806e5f99ae4adf73
2013-09-02 17:01:58 +01:00
Jenkins 2edabf0141 Merge "Remove travis CI from repo." 2013-08-18 21:30:05 +00:00
Monty Taylor 3ddfcdbb2e Update stackforge references to openstack
Change-Id: Ibd777b5d9dbb19970aec537fe0145d97287d31f2
2013-08-17 22:59:30 -04:00
Clint Byrum 40ff4e899e Remove travis CI from repo.
We don't use travis CI anymore.

Change-Id: I84c0fb516ebfca2c4de57417fa891e95d90b77b3
2013-08-16 08:22:22 -07:00
Robert Collins 5b8fd361c2 Stop resetting logging on every call to __main__.
__main__ is called directly during tests, but was resetting the
logging environment within it, which prevented tests from capturing
the log events.

Change-Id: If710e11091723144c97c88aab4aa5e6126844d2b
2013-08-16 17:29:58 +12:00
Robert Collins f20f9954db Stop using tearDown.
TestCase.tearDown doesn't get called if setUp fails, it should never
be used.

Change-Id: Ib960c3f9610d8d8a0624e0c0709afa819e1858ad
2013-08-16 17:29:58 +12:00
Clint Byrum 1897ecf001 Do not cache new data if command fails
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.

Change-Id: Idf3a09686b4bbf0e16a9bc9f3359ee9937fcc627
2013-08-16 17:29:58 +12:00
Robert Collins 4bdefc2041 Document the last file presence.
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.

Change-Id: Ia29c1ef9e10308d6461dae7823c5f497f6b90122
2013-08-16 17:29:58 +12:00
Robert Collins 98c8588867 Switch to StringStream.
In Python 3 stdout is a text stream not a byte stream, so we should be
prepared for that.

Change-Id: I4bc1151e491226f24591e9b3436db8d5d37fca65
2013-08-16 17:29:58 +12:00
Robert Collins def1daa155 Rework test_main to use FakePopen.
FakePopen will make the migration to check_call easier, and narrowly
replaces the engire rather than replacing the subprocess entry point.

Change-Id: Ic868ce4cdbef79f256ef01a9a030767522b855a3
2013-08-16 17:29:55 +12:00
Robert Collins d809ef9a8d Bump minimum version of fixtures.
We need a fixed version of FakePopen to improve the test harness.

Change-Id: I8e0fcb9943038b48f6c1256b6fefe47bf0323cbf
2013-08-16 15:15:56 +12:00
Clint Byrum 13b6732546 Reverse default order of collectors.
The default order results in less-dynamic heat_local and ec2 overriding
the more dynamic cfn source. That is the opposite of what is desired.

Change-Id: I7e1feb2e6869b4f076200668dd204219ecc4224e
2013-08-15 11:22:50 -07:00
Jenkins 0238175a89 Merge "Ignore H803 checks from flake8" 2013-08-06 07:09:02 +00:00
Jenkins bf31e030c4 Merge "Fix a hacking complaint" 2013-08-06 07:08:37 +00:00
Robert Collins 0e107ca7aa Ignore H803 checks from flake8
H803 isn't supported by community consensus. Blacklist it.

Change-Id: I50f3d545f694827507ffd238f41a38c0b12e3a59
2013-08-06 16:14:55 +12:00
Robert Collins e017b0d09f Fix a hacking complaint
We can't land changes while hacking is unhappy.

Change-Id: I8ae913a965cd9be1fecec9ea960b90c8a69dca2b
2013-08-06 16:14:55 +12:00
Clint Byrum 2d4451a80f Fix heat hint file reading to work properly
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.

Change-Id: Ifb74546db16836aaa67fdd647aad2c5cf8aa84b4
2013-08-01 22:21:08 -07:00
Clint Byrum 3722ca41e2 Fixing crash during commit when collection failed
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.

Change-Id: I726c7bbaa561a3c21b61eba5e5d100b0fe324954
2013-08-01 22:21:08 -07:00
Clint Byrum 1dcc5a3571 Re-execute after commands and on SIGHUP
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.

Change-Id: I87b4d8ce44fcbc9458a3a4fbb2445e4c9d0ad4e7
2013-08-01 22:21:05 -07:00
Clint Byrum 4cc2c41bbc Use heat-cfntools path hint for cfn.metadata_url
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.

Change-Id: I52093bdd8a4b939ae06cf483535ed5d5a0e273d4
2013-07-19 12:34:03 -07:00
Clint Byrum 3e2001e5ba Run forever if a command is configured
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.

Change-Id: Ic91f2201d504e9f8e0ada6d34a7d6d94785aec87
2013-07-19 12:34:00 -07:00
Clint Byrum 737fff67c3 Fixes for hacking 0.6
- Add missing License Header to exc.
- Use python 3 compatible print.

Change-Id: Ibbcbfadffb978f9d8789e1fbc0c0819da06489d3
2013-07-19 12:32:24 -07:00
Jenkins 367fb38267 Merge "Detect invalid collectors." 2013-07-07 18:01:19 +00:00
Jenkins 49887aa4bf Merge "Allow changing the collectors that are used." 2013-07-07 17:52:37 +00:00
Monty Taylor b041fb363e Ensure that README file makes it into the tarball
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 to
ensure that AUTHORS and ChangeLog get installed too.

Change-Id: Id59fa5a6fecc179a80710ba8a5dc898fb713b1cf
2013-07-07 11:56:08 -04:00
Clint Byrum 140e527458 Detect invalid collectors.
The program would blow up anyway, but provide users with a more friendly
error message.

Change-Id: If70fc27b61963058af036568b88535b7f2dcff3f
2013-07-07 08:55:28 -07:00
Clint Byrum ba6c781db0 Allow changing the collectors that are used.
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.

Change-Id: I7e76db991c0b16c529c1cbf9a1ba9beb78e45482
2013-07-07 08:50:45 -07:00
Clint Byrum a3a93a9130 Enable heat_local collector. 2013-07-03 17:29:04 -07:00
Clint Byrum c42f3e46a7 Add heat_local for locally injected metadata.
Functionality has been added, but it is not called in main.
2013-07-03 17:00:05 -07:00
Clint Byrum 3b97d9c8fc Correct inaccuracies in 2013-07-03 12:54:14 -07:00
Clint Byrum 544d6093d0 Correct title in 2013-07-03 12:50:02 -07:00
Clint Byrum 24ffbf5356 Fix problems exposed by trying against heat-api-cfn. 2013-07-03 12:44:37 -07:00
Clint Byrum ffb503ed04 Use Ec2Signer from keystoneclient
Also refactor some tests for less confusing monkeypatching.
2013-07-02 15:27:03 -07:00
Clint Byrum d78808a9a8 Add handling of a failing source.
Also fix intermittent race with cfg.CONF
2013-07-02 13:28:15 -07:00
Clint Byrum 0c7f4dfb43 Switch to using isolated collect_all
Also Fix some niggles introduced in last patch.
2013-07-02 12:38:36 -07:00
Clint Byrum ec371c4421 isolate collect_all from main 2013-07-02 12:31:07 -07:00
Clint Byrum c56c63ddab Factor out generic call to main 2013-07-02 10:36:14 -07:00
Clint Byrum a13845a737 Run all collectors.
Also refactor internal API a bit to make code more generic.
2013-07-02 10:17:13 -07:00
Clint Byrum e10ce66791 Fix bugs and improve test coverage for cfn. 2013-07-02 00:47:02 -07:00
Clint Byrum 7efd87df87 Cover unconfigured cfn.metadata_url 2013-07-02 00:37:03 -07:00
Clint Byrum 3cf47cefd6 Actual implementation of CloudFormation 2013-07-01 23:52:55 -07:00