def report(options, policies): assert len(policies) == 1, "Only one policy report at a time" policy = policies.pop() d = datetime.now() delta = timedelta(days=options.days) begin_date = d - delta do_report(policy, begin_date, sys.stdout, raw_output_fh=options.raw)
def report(options, policies): assert len(policies) == 1, "Only one policy report at a time" policy = policies.pop() d = datetime.now() delta = timedelta(days=options.days) begin_date = d - delta do_report( policy, begin_date, sys.stdout, raw_output_fh=options.raw)
def report(options, policies): if len(policies) == 0: log.error('Error: must supply at least one policy') sys.exit(1) resources = set([p.resource_type for p in policies]) if len(resources) > 1: log.error('Error: Report subcommand can accept multiple policies, ' 'but they must all be for the same resource.') sys.exit(1) delta = timedelta(days=options.days) begin_date = datetime.now() - delta do_report( policies, begin_date, options, sys.stdout, raw_output_fh=options.raw)
def report(options, policies): if len(policies) != 1: eprint("Error: Report subcommand requires exactly one policy") sys.exit(1) policy = policies.pop() odir = options.output_dir.rstrip(os.path.sep) if os.path.sep in odir and os.path.basename(odir) == policy.name: # policy sub-directory passed - ignore options.output_dir = os.path.split(odir)[0] # regenerate the execution context based on new path policy = Policy(policy.data, options) d = datetime.now() delta = timedelta(days=options.days) begin_date = d - delta do_report( policy, begin_date, options, sys.stdout, raw_output_fh=options.raw)
def report(options, policies): if len(policies) != 1: eprint("Error: Report subcommand requires exactly one policy") sys.exit(1) policy = policies.pop() odir = options.output_dir.rstrip(os.path.sep) if os.path.sep in odir and os.path.basename(odir) == policy.name: options.region = options.regions[0] # policy sub-directory passed - ignore options.output_dir = os.path.split(odir)[0] # regenerate the execution context based on new path policy = Policy(policy.data, options) d = datetime.now() delta = timedelta(days=options.days) begin_date = d - delta do_report( policy, begin_date, options, sys.stdout, raw_output_fh=options.raw)