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) 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',