Replace --dryrun with --target and --clean actions

By default do nothing, force user to specify --target to do the
targeting of completed blueprints and --clean to do the cleaning of
incomplete blueprints.

Change-Id: If2e13eaee230515d44cbd76fa3675ba0d8343cbf
This commit is contained in:
Doug Hellmann 2015-06-23 10:54:47 -04:00 committed by Thierry Carrez
parent 10ffd1a406
commit f340cc2e3e
2 changed files with 13 additions and 8 deletions

View File

@ -568,6 +568,11 @@ of blueprints for a given project and:
Examples:
./adjust_blueprints.py nova liberty-1 --dryrun
./adjust_blueprints.py nova liberty-1
Displays proposed adjustments around Nova liberty-1 blueprints.
./adjust_blueprints.py nova liberty-1 --target --clean
Targets missing implemented blueprints and cleans incomplete ones for Nova
in liberty-1.

View File

@ -24,7 +24,10 @@ import sys
parser = ArgumentParser(description="Update BPs on milestone closure")
parser.add_argument('project', help='The project to act on')
parser.add_argument('milestone', help='The milestone to set')
parser.add_argument("--dryrun", action='store_true', help='Do not do anything')
parser.add_argument("--target", action='store_true',
help='Set target and/or series goal for implemented BPs')
parser.add_argument("--clear", action='store_true',
help='Clear milestone from incomplete blueprints')
parser.add_argument("--test", action='store_const', const='staging',
default='production', help='Use LP staging server to test')
args = parser.parse_args()
@ -40,9 +43,6 @@ if not milestone:
parser.error('Target milestone %s does not exist' % args.milestone)
series = milestone.series_target
if (args.dryrun):
print "Dry run mode -- this will actually not do anything"
# Get the blueprints
print "Retrieving blueprints...",
now = datetime.now(tz=pytz.utc)
@ -79,7 +79,7 @@ if (to_target):
print "Those are implemented: need milestone target added"
for bp in to_target:
print bp.web_link
if not args.dryrun:
if args.target:
bp.milestone = milestone
bp.lp_save()
@ -88,7 +88,7 @@ if (to_series):
print "Those are implemented: need series goal added/approved"
for bp in to_series:
print bp.web_link
if not args.dryrun:
if args.target:
bp.proposeGoal(goal=series)
if (to_clear):
@ -96,6 +96,6 @@ if (to_clear):
print "Those are incomplete: need their milestone target cleared"
for bp in to_clear:
print bp.web_link
if not args.dryrun:
if args.clear:
bp.milestone = None
bp.lp_save()