From d539664a411afe7a5a8b9356a5c64cb644b4dfc9 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 | 7 ++++--- awscli/handlers.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/awscli/customizations/cloudfront.py b/awscli/customizations/cloudfront.py index 0c89994178e2..5e19bc7c14a6 100644 --- a/awscli/customizations/cloudfront.py +++ b/awscli/customizations/cloudfront.py @@ -32,7 +32,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 = [ { @@ -58,7 +58,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) @@ -74,8 +74,9 @@ def _run_main(self, args, parsed_globals): return 0 -class RsaSigner(object): +class RSASigner(object): def __init__(self, private_key): self.priv_key = rsa.PrivateKey.load_pkcs1(private_key.encode('utf8')) + def sign(self, message): return rsa.sign(message, self.priv_key, 'SHA-1') 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)