Make heat the default collection method

Previously we were relying on the CFN compatibility API. This makes the
native Heat version the default.

Note that we want to keep full coverage, which is why we are explicitly
adding cfn back in during tests.

Change-Id: I5adedd052827e176e2f39071c719600df62019d7
Closes-Bug: #1321551
This commit is contained in:
Clint Byrum 2014-05-20 21:18:24 -07:00
parent ee911cfb69
commit 6b478e9d90
2 changed files with 10 additions and 4 deletions

View File

@ -33,7 +33,8 @@ from os_collect_config import keystone
from os_collect_config import version
from oslo.config import cfg
DEFAULT_COLLECTORS = ['heat_local', 'ec2', 'cfn', 'heat']
ALL_COLLECTORS = ['heat_local', 'ec2', 'heat', 'cfn']
DEFAULT_COLLECTORS = ['heat_local', 'ec2', 'heat']
opts = [
cfg.StrOpt('command', short='c',
help='Command to run on metadata changes. If specified,'
@ -205,11 +206,11 @@ def __main__(args=sys.argv, collector_kwargs_map=None):
print(CONF.cachedir)
return
unknown_collectors = set(CONF.collectors) - set(DEFAULT_COLLECTORS)
unknown_collectors = set(CONF.collectors) - set(ALL_COLLECTORS)
if unknown_collectors:
raise exc.InvalidArguments(
'Unknown collectors %s. Valid collectors are: %s' %
(list(unknown_collectors), DEFAULT_COLLECTORS))
(list(unknown_collectors), ALL_COLLECTORS))
if CONF.force:
CONF.set_override('one_time', True)

View File

@ -114,7 +114,8 @@ class TestCollect(testtools.TestCase):
'--heat-stack-id',
'a/c482680f-7238-403d-8f76-36acf0c8e0aa',
'--heat-resource-name',
'server'
'server',
'heat_local', 'ec2', 'cfn', 'heat',
]
calls = self._fake_popen_call_main(occ_args)
proc_args = calls[0]
@ -203,6 +204,7 @@ class TestCollect(testtools.TestCase):
'0123456789ABCDEF',
'--cfn-secret-access-key',
'FEDCBA9876543210',
'heat_local', 'ec2', 'cfn', 'heat',
]
fake_metadata = _setup_local_metadata(self)
fake_args.append('--heat_local-path')
@ -254,6 +256,7 @@ class TestCollect(testtools.TestCase):
'--cfn-secret-access-key',
'FEDCBA9876543210',
'--heat_local-path', fake_metadata,
'heat_local', 'ec2', 'cfn', 'heat',
]
def fake_popen(args):
@ -338,6 +341,8 @@ class TestCollectAll(testtools.TestCase):
}
if collectors is None:
collectors = cfg.CONF.collectors
if 'cfn' not in collectors:
collectors.append('cfn')
return collect.collect_all(
collectors,
store=store,