Init an Auth instance :param dict opts: Options for this server :return: Auth instance :rtype: Auth
(self, opts, io_loop=None)
| 959 | |
| 960 | # an init for the singleton instance to call |
| 961 | def __singleton_init__(self, opts, io_loop=None): |
| 962 | """ |
| 963 | Init an Auth instance |
| 964 | |
| 965 | :param dict opts: Options for this server |
| 966 | :return: Auth instance |
| 967 | :rtype: Auth |
| 968 | """ |
| 969 | self.opts = opts |
| 970 | self.token = salt.utils.stringutils.to_bytes(Crypticle.generate_key_string()) |
| 971 | self.cache = salt.cache.Cache(opts, driver=opts["keys.cache_driver"]) |
| 972 | self.pub_path = os.path.join(self.opts["pki_dir"], "minion.pub") |
| 973 | self.rsa_path = os.path.join(self.opts["pki_dir"], "minion.pem") |
| 974 | self._private_key = None |
| 975 | if self.opts["__role"] == "syndic": |
| 976 | self.mpub = "syndic_master.pub" |
| 977 | else: |
| 978 | self.mpub = "minion_master.pub" |
| 979 | if not os.path.isfile(self.pub_path): |
| 980 | self.get_keys() |
| 981 | if io_loop is None: |
| 982 | self.io_loop = salt.utils.asynchronous.aioloop( |
| 983 | tornado.ioloop.IOLoop.current() |
| 984 | ) |
| 985 | else: |
| 986 | self.io_loop = salt.utils.asynchronous.aioloop(io_loop) |
| 987 | key = self.__key(self.opts) |
| 988 | # TODO: if we already have creds for this key, lets just re-use |
| 989 | if key in AsyncAuth.creds_map: |
| 990 | creds = AsyncAuth.creds_map[key] |
| 991 | self._creds = creds |
| 992 | self._crypticle = Crypticle(self.opts, creds["aes"]) |
| 993 | self._session_crypticle = Crypticle(self.opts, creds["session"]) |
| 994 | self._authenticate_future = tornado.concurrent.Future() |
| 995 | self._authenticate_future.set_result(True) |
| 996 | |
| 997 | def __deepcopy__(self, memo): |
| 998 | cls = self.__class__ |
nothing calls this directly
no test coverage detected