From 1739ff32d544c70c1c7ab51d638565a4405f754c Mon Sep 17 00:00:00 2001 From: Takuya Sawada Date: Wed, 17 May 2017 18:22:55 +0900 Subject: [PATCH 1/2] [mod] Fix #14 suppor environment variable for aws credential --- r53update/r53update.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/r53update/r53update.py b/r53update/r53update.py index eb4127d..40e44d2 100755 --- a/r53update/r53update.py +++ b/r53update/r53update.py @@ -116,14 +116,18 @@ class R53UpdateApp(App): ## # Context class Context(object): - def __init__(self, profile=''): + def __init__(self, profile=None): self.session = Session() self.session.profile = profile - + def getR53Connection(self): + credential = self.session.get_credentials() + if not credential: + raise RuntimeError("failed to get aws credential") + return Route53Connection( - self.session.get_scoped_config()['aws_access_key_id'], - self.session.get_scoped_config()['aws_secret_access_key'] + credential.access_key, + credential.secret_key ) ## @@ -218,7 +222,7 @@ def _pre_init(self): self._gipmethods['localhost'] = R53UpdateApp.NETIFACES_GlobalIP_DetectionMethod(self) # optional argument - self._parser.add_argument('--profile', type=str, metavar='PROFILE', default='', + self._parser.add_argument('--profile', type=str, metavar='PROFILE', default=None, help='name of a profile to use, or "default" to use the default profile').completer = R53UpdateApp.ProfileCompleter(self) self._parser.add_argument('--method', type=str, metavar='METHOD', default='opendns.com', help='detection method of global IP').completer = R53UpdateApp.MethodCompleter(self) From 20fc5299228c4abbfbeebff2275c078b4d9a4866 Mon Sep 17 00:00:00 2001 From: Takuya Sawada Date: Thu, 1 Jun 2017 02:32:52 +0900 Subject: [PATCH 2/2] [mod] change version number to '0.5.2' --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 88f4242..76b6934 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ setup( name = 'r53update', - version='0.5.1', + version='0.5.2', description='R53Update Dynamic DNS Updater', author='Takuya Sawada', author_email='takuya@tuntunkun.com',