mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-05 13:14:46 +02:00
rrs/tools: add -p/--plan option
Add an option to specify which maintenance plan to operate on (largely for debugging purposes). Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
baa3f78498
commit
201c74ca0f
|
@ -92,13 +92,23 @@ if __name__=="__main__":
|
|||
help = "Do not write any data back to the database",
|
||||
action="store_true", dest="dry_run", default=False)
|
||||
|
||||
parser.add_option("-p", "--plan",
|
||||
help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
|
||||
action="store", dest="plan", default=None)
|
||||
|
||||
options, args = parser.parse_args(sys.argv)
|
||||
logger.setLevel(options.loglevel)
|
||||
|
||||
maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
|
||||
if not maintplans.exists():
|
||||
logger.error('No enabled maintenance plans found')
|
||||
sys.exit(1)
|
||||
if options.plan:
|
||||
maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
|
||||
if not maintplans.exists():
|
||||
logger.error('No maintenance plan with ID %s found' % options.plan)
|
||||
sys.exit(1)
|
||||
else:
|
||||
maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
|
||||
if not maintplans.exists():
|
||||
logger.error('No enabled maintenance plans found')
|
||||
sys.exit(1)
|
||||
|
||||
logger.debug("Starting recipe distros update ...")
|
||||
|
||||
|
|
|
@ -72,10 +72,16 @@ def get_commit_info(info, logger):
|
|||
"""
|
||||
def maintainer_history(options, logger):
|
||||
fetchdir = settings.LAYER_FETCH_DIR
|
||||
maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
|
||||
if not maintplans.exists():
|
||||
logger.error('No enabled maintenance plans found')
|
||||
sys.exit(1)
|
||||
if options.plan:
|
||||
maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
|
||||
if not maintplans.exists():
|
||||
logger.error('No maintenance plan with ID %s found' % options.plan)
|
||||
sys.exit(1)
|
||||
else:
|
||||
maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
|
||||
if not maintplans.exists():
|
||||
logger.error('No enabled maintenance plans found')
|
||||
sys.exit(1)
|
||||
|
||||
no_maintainer, _ = Maintainer.objects.get_or_create(name='No maintainer')
|
||||
|
||||
|
@ -191,6 +197,10 @@ def maintainer_history(options, logger):
|
|||
if __name__=="__main__":
|
||||
parser = optparse.OptionParser(usage = """%prog [options]""")
|
||||
|
||||
parser.add_option("-p", "--plan",
|
||||
help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
|
||||
action="store", dest="plan", default=None)
|
||||
|
||||
parser.add_option("--fullreload",
|
||||
help="Reload upgrade data from scratch",
|
||||
action="store_true", dest="fullreload", default=False)
|
||||
|
|
|
@ -89,10 +89,16 @@ def run_internal(maintplanlayerbranch, commit, commitdate, options, logger, bitb
|
|||
def upgrade_history(options, logger):
|
||||
from rrs.models import MaintenancePlan, RecipeUpgrade
|
||||
|
||||
maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
|
||||
if not maintplans.exists():
|
||||
logger.error('No enabled maintenance plans found')
|
||||
sys.exit(1)
|
||||
if options.plan:
|
||||
maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
|
||||
if not maintplans.exists():
|
||||
logger.error('No maintenance plan with ID %s found' % options.plan)
|
||||
sys.exit(1)
|
||||
else:
|
||||
maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
|
||||
if not maintplans.exists():
|
||||
logger.error('No enabled maintenance plans found')
|
||||
sys.exit(1)
|
||||
|
||||
lockfn = os.path.join(fetchdir, "layerindex.lock")
|
||||
lockfile = utils.lock_file(lockfn)
|
||||
|
@ -205,6 +211,10 @@ if __name__=="__main__":
|
|||
help="Reload upgrade data from scratch",
|
||||
action="store_true", dest="fullreload", default=False)
|
||||
|
||||
parser.add_option("-p", "--plan",
|
||||
help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
|
||||
action="store", dest="plan", default=None)
|
||||
|
||||
options, args = parser.parse_args(sys.argv)
|
||||
logger.setLevel(options.loglevel)
|
||||
|
||||
|
|
|
@ -123,6 +123,10 @@ def main():
|
|||
usage = """
|
||||
%prog [options]""")
|
||||
|
||||
parser.add_option("-p", "--plan",
|
||||
help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
|
||||
action="store", dest="plan", default=None)
|
||||
|
||||
parser.add_option("-s", "--subject",
|
||||
action="store", dest="subject", help='Override email subject')
|
||||
parser.add_option("-f", "--from",
|
||||
|
@ -139,10 +143,16 @@ def main():
|
|||
options, args = parser.parse_args(sys.argv)
|
||||
|
||||
# get recipes for send email
|
||||
maintplans = MaintenancePlan.objects.filter(email_enabled=True)
|
||||
if not maintplans.exists():
|
||||
logger.error('No maintenance plans with email enabled were found')
|
||||
sys.exit(1)
|
||||
if options.plan:
|
||||
maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
|
||||
if not maintplans.exists():
|
||||
logger.error('No maintenance plan with ID %s found' % options.plan)
|
||||
sys.exit(1)
|
||||
else:
|
||||
maintplans = MaintenancePlan.objects.filter(email_enabled=True)
|
||||
if not maintplans.exists():
|
||||
logger.error('No maintenance plans with email enabled were found')
|
||||
sys.exit(1)
|
||||
|
||||
for maintplan in maintplans:
|
||||
recipes = {}
|
||||
|
|
|
@ -134,7 +134,11 @@ def get_upstream_info(layerbranch, recipe_data, result):
|
|||
|
||||
if __name__=="__main__":
|
||||
parser = optparse.OptionParser(usage = """%prog [options]""")
|
||||
|
||||
|
||||
parser.add_option("-p", "--plan",
|
||||
help="Specify maintenance plan to operate on (default is all plans that have updates enabled)",
|
||||
action="store", dest="plan", default=None)
|
||||
|
||||
parser.add_option("-d", "--debug",
|
||||
help = "Enable debug output",
|
||||
action="store_const", const=logging.DEBUG, dest="loglevel", default=logging.INFO)
|
||||
|
@ -146,12 +150,18 @@ if __name__=="__main__":
|
|||
options, args = parser.parse_args(sys.argv)
|
||||
logger.setLevel(options.loglevel)
|
||||
|
||||
logger.debug("Starting upstream history...")
|
||||
if options.plan:
|
||||
maintplans = MaintenancePlan.objects.filter(id=int(options.plan))
|
||||
if not maintplans.exists():
|
||||
logger.error('No maintenance plan with ID %s found' % options.plan)
|
||||
sys.exit(1)
|
||||
else:
|
||||
maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
|
||||
if not maintplans.exists():
|
||||
logger.error('No enabled maintenance plans found')
|
||||
sys.exit(1)
|
||||
|
||||
maintplans = MaintenancePlan.objects.filter(updates_enabled=True)
|
||||
if not maintplans.exists():
|
||||
logger.error('No enabled maintenance plans found')
|
||||
sys.exit(1)
|
||||
logger.debug("Starting upstream history...")
|
||||
|
||||
lockfn = os.path.join(fetchdir, "layerindex.lock")
|
||||
lockfile = utils.lock_file(lockfn)
|
||||
|
|
Loading…
Reference in New Issue
Block a user