diff --git a/salt/auth/__init__.py b/salt/auth/__init__.py index 1eae827312f2..f1bfb40ade01 100644 --- a/salt/auth/__init__.py +++ b/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