Skip to content

Commit

Permalink
Add resolver method for generating token
Browse files Browse the repository at this point in the history
  • Loading branch information
thatch45 committed Oct 9, 2012
1 parent a3774b8 commit 3f36c90
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion salt/auth/__init__.py
Expand Up @@ -151,6 +151,7 @@ class Resolver(object):
def __init__(self, opts): def __init__(self, opts):
self.opts = opts self.opts = opts
self.auth = salt.loader.auth(opts) self.auth = salt.loader.auth(opts)
self.serial = salt.payload.Serial(opts)


def cli(self, eauth): def cli(self, eauth):
''' '''
Expand Down Expand Up @@ -190,4 +191,9 @@ def token_cli(self, eauth):
''' '''
load = self.cli(eauth) load = self.cli(eauth)
tdata = self.auth.mktoken(load) tdata = self.auth.mktoken(load)

try:
with open(self.opts['token_file'], 'w+') as fp_:
fp_.write(self.serial.dumps(tdata))
except (IOError, OSError):
pass
return tdata

0 comments on commit 3f36c90

Please sign in to comment.