Skip to content

Commit

Permalink
don't save HUB_APIKEY to conf (security)
Browse files Browse the repository at this point in the history
rational: if you launch a cloudtask from a command line or environment, you
may not want the apikey hanging around forever in the session configuration.
  • Loading branch information
lirazsiri committed Aug 5, 2011
1 parent 0317ba1 commit a8936bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion cloudtask/session.py
Expand Up @@ -168,7 +168,9 @@ def taskconf(self, val=UNDEFINED):
if val is UNDEFINED:
return TaskConf.fromdict(eval(file(path).read()))
else:
print >> file(path, "w"), pprint.pformat(val.dict())
d = val.dict()
del d['hub_apikey']
print >> file(path, "w"), pprint.pformat(d)
taskconf = property(taskconf, taskconf)

@property
Expand Down
6 changes: 3 additions & 3 deletions cloudtask/task.py
Expand Up @@ -208,12 +208,12 @@ def main(cls):
for attr in taskconf.__all__:
taskconf[attr] = getattr(cls, attr.upper())

if not taskconf.hub_apikey:
taskconf.hub_apikey = os.environ.get('HUB_APIKEY')

if taskconf.overlay and not taskconf.overlay.startswith('/'):
taskconf.overlay = abspath(join(dirname(sys.argv[0]), taskconf.overlay))

if not taskconf.hub_apikey:
taskconf.hub_apikey = os.environ.get('HUB_APIKEY')

for opt, val in opts:
if opt in ('--resume', '--sessions', '--force'):
continue
Expand Down

0 comments on commit a8936bb

Please sign in to comment.