Skip to content
This repository
Browse code

Add resolver method for generating token

  • Loading branch information...
commit 3f36c901b928a4a2b9fd6756fb6824fd8a45890e 1 parent a3774b8
Thomas S Hatch thatch45 authored

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. +7 1 salt/auth/__init__.py
8 salt/auth/__init__.py
@@ -151,6 +151,7 @@ class Resolver(object):
151 151 def __init__(self, opts):
152 152 self.opts = opts
153 153 self.auth = salt.loader.auth(opts)
  154 + self.serial = salt.payload.Serial(opts)
154 155
155 156 def cli(self, eauth):
156 157 '''
@@ -190,4 +191,9 @@ def token_cli(self, eauth):
190 191 '''
191 192 load = self.cli(eauth)
192 193 tdata = self.auth.mktoken(load)
193   -
  194 + try:
  195 + with open(self.opts['token_file'], 'w+') as fp_:
  196 + fp_.write(self.serial.dumps(tdata))
  197 + except (IOError, OSError):
  198 + pass
  199 + return tdata

0 comments on commit 3f36c90

Please sign in to comment.
Something went wrong with that request. Please try again.