Skip to content

Commit

Permalink
Minor code style adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
rayluo committed Dec 8, 2015
1 parent fbcab9c commit a14dc95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions awscli/customizations/cloudfront.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
{
Expand All @@ -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)
Expand All @@ -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'))

Expand Down
4 changes: 2 additions & 2 deletions awscli/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

0 comments on commit a14dc95

Please sign in to comment.