From a14dc954974067fb2c787ccc2d5baf4ea099aa8f Mon Sep 17 00:00:00 2001 From: Ray Luo Date: Mon, 7 Dec 2015 18:17:43 -0800 Subject: [PATCH] Minor code style adjustments --- awscli/customizations/cloudfront.py | 9 +++++---- awscli/handlers.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/awscli/customizations/cloudfront.py b/awscli/customizations/cloudfront.py index d7a3145bbd3e..e74ff900e2b9 100644 --- a/awscli/customizations/cloudfront.py +++ b/awscli/customizations/cloudfront.py @@ -68,7 +68,7 @@ class SignCommand(BasicCommand): YYYY-MM-DD (which means 0AM UTC of that day), YYYY-MM-DDThh:mm:ss (with default timezone as UTC), YYYY-MM-DDThh:mm:ss+hh:mm or YYYY-MM-DDThh:mm:ss-hh:mm (with offset), - or EpochTime. + or EpochTime (which always means UTC). Do NOT use YYYYMMDD, because it will be treated as EpochTime.""" ARG_TABLE = [ { @@ -94,7 +94,7 @@ class SignCommand(BasicCommand): def _run_main(self, args, parsed_globals): signer = CloudFrontSigner( - args.key_pair_id, RsaSigner(args.private_key).sign) + args.key_pair_id, RSASigner(args.private_key).sign) date_less_than = parse_to_aware_datetime(args.date_less_than) if args.date_greater_than is not None: date_greater_than = parse_to_aware_datetime(args.date_greater_than) @@ -106,11 +106,12 @@ def _run_main(self, args, parsed_globals): ip_address=args.ip_address) print(signer.generate_presigned_url(args.url, policy=policy)) else: - print(signer.generate_presigned_url(args.url, date_less_than)) + print(signer.generate_presigned_url(args.url, + date_less_than=date_less_than)) return 0 -class RsaSigner(object): +class RSASigner(object): def __init__(self, private_key): self.priv_key = rsa.PrivateKey.load_pkcs1(private_key.encode('utf8')) diff --git a/awscli/handlers.py b/awscli/handlers.py index c5f780bac58b..4c61e8ee785e 100644 --- a/awscli/handlers.py +++ b/awscli/handlers.py @@ -33,7 +33,7 @@ from awscli.customizations.rds import register_rds_modify_split from awscli.customizations.putmetricdata import register_put_metric_data from awscli.customizations.sessendemail import register_ses_send_email -from awscli.customizations.cloudfront import register as cloudfront_register +from awscli.customizations.cloudfront import register as register_cloudfront from awscli.customizations.iamvirtmfa import IAMVMFAWrapper from awscli.customizations.argrename import register_arg_renames from awscli.customizations.configure import register_configure_cmd @@ -109,7 +109,6 @@ def awscli_initialize(event_handlers): register_rds_modify_split(event_handlers) register_put_metric_data(event_handlers) register_ses_send_email(event_handlers) - cloudfront_register(event_handlers) IAMVMFAWrapper(event_handlers) register_arg_renames(event_handlers) register_configure_cmd(event_handlers) @@ -142,3 +141,4 @@ def awscli_initialize(event_handlers): event_handlers.register( 'building-argument-table.iot.create-certificate-from-csr', register_create_keys_from_csr_arguments) + register_cloudfront(event_handlers)