def authenticate_juju(self): uuid = self.config.juju_env['environ-uuid'] if not len(self.config.juju_env['state-servers']) > 0: state_server = 'localhost:17070' else: state_server = self.config.juju_env['state-servers'][0] url = path.join('wss://', state_server, 'environment', uuid, 'api') self.juju = JujuClient(url=url, password=self.config.juju_api_password) self.juju.login() self.juju_state = JujuState(self.juju) log.debug('Authenticated against Juju: {}'.format(url))
def juju_state(): cfg = Config(CONFIGOBJ) uuid = cfg.juju_env['environ-uuid'] if not len(cfg.juju_env['state-servers']) > 0: state_server = 'localhost:17070' else: state_server = cfg.juju_env['state-servers'][0] url = path.join('wss://', state_server, 'environment', uuid, 'api') juju = JujuClient(url=url, password=cfg.juju_api_password) juju.login() return JujuState(juju)