Imply --one-time when --force is used

Without this change, if a user runs os-collect-config --force, it will
lock the user in an infinite loop running the command over and over with
very little chance to cancel. There are no compelling use cases for that
behavior, but it is extremely inconvenient, so implying --one-time
improves usability of os-collect-config for users.

Change-Id: Ia8c9bf0bf97ab9e40e465c947c2f0cbeb981c08e
This commit is contained in:
Clint Byrum 2013-10-05 23:35:52 -07:00
parent ff45223f13
commit e82a98f127
1 changed files with 4 additions and 1 deletions

View File

@ -62,7 +62,7 @@ opts = [
cfg.BoolOpt('force',
default=False,
help='Pass this to force running the command even if nothing'
' has changed.'),
' has changed. Implies --one-time.'),
cfg.BoolOpt('print', dest='print_only',
default=False,
help='Query normally, print the resulting configs as a json'
@ -187,6 +187,9 @@ def __main__(args=sys.argv, requests_impl_map=None):
'Unknown collectors %s. Valid collectors are: %s' %
(list(unknown_collectors), DEFAULT_COLLECTORS))
if CONF.force:
CONF.set_override('one_time', True)
config_files = CONF.config_file
config_hash = getfilehash(config_files)
while True: