Permalink
Browse files

Add resolver method for generating token

  • Loading branch information...
1 parent a3774b8 commit 3f36c901b928a4a2b9fd6756fb6824fd8a45890e @thatch45 thatch45 committed Oct 9, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 salt/auth/__init__.py
@@ -151,6 +151,7 @@ class Resolver(object):
def __init__(self, opts):
self.opts = opts
self.auth = salt.loader.auth(opts)
+ self.serial = salt.payload.Serial(opts)
def cli(self, eauth):
'''
@@ -190,4 +191,9 @@ def token_cli(self, eauth):
'''
load = self.cli(eauth)
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.