Esempio n. 1
0
 def setUp(self):
     self.juju = None
     if JUJU_USELIVE and JUJU_INSTALLED:
         self.juju = JujuState(_run('juju status').decode('ascii'))
     else:
         with open('test/juju-output/juju-status-multi-install.yaml') as f:
             self.juju = JujuState(f.read())
 def test_some_services_ready(self):
     """ Verifies some ready services == not_ready list """
     juju_state = JujuState(juju=MagicMock())
     services = PropertyMock(return_value=self.services_some_ready)
     type(juju_state).services = services
     not_ready = [(a, b) for a, b in juju_state.get_agent_states()
                  if b != 'started']
     self.assertEqual(len(not_ready), 2)
     self.assertFalse(juju_state.all_agents_started())
def juju_state():
    cfg = Config(CONFIGOBJ)
    if not len(cfg.juju_env['state-servers']) > 0:
        state_server = 'localhost:17070'
    else:
        state_server = cfg.juju_env['state-servers'][0]
    juju = JujuClient(url=path.join('wss://', state_server),
                      password=cfg.juju_api_password)
    juju.login()
    return JujuState(juju)
Esempio n. 4
0
 def authenticate_juju(self):
     if not len(self.config.juju_env['state-servers']) > 0:
         state_server = 'localhost:17070'
     else:
         state_server = self.config.juju_env['state-servers'][0]
     self.juju = JujuClient(url=path.join('wss://', state_server),
                            password=self.config.juju_api_password)
     self.juju.login()
     self.juju_state = JujuState(self.juju)
     log.debug('Authenticated against juju api.')
Esempio n. 5
0
 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)
Esempio n. 7
0
    def setUp(self):
        self.conf = Config({})
        self.mock_ui = MagicMock(name='ui')
        self.mock_log = MagicMock(name='log')
        self.mock_loop = MagicMock(name='loop')

        self.conf.setopt('headless', False)
        self.dc = Controller(
            ui=self.mock_ui, config=self.conf,
            loop=self.mock_loop)
        self.dc.initialize = MagicMock()
        self.dc.juju_state = JujuState(juju=MagicMock())
        self.dc.juju_state.all_agents_started = MagicMock()
Esempio n. 8
0
    def setUp(self):
        with open('test/juju-output/juju-status-single-install.yaml') as f:
            self.juju = JujuState(f.read())

        self.m_one = self.juju.machine("1")
        self.c_one = self.m_one.container("1/lxc/0")
Esempio n. 9
0
 def setUp(self):
     with open('test/juju-output/juju-status-single-pre-deploy.yaml') as f:
         self.juju = JujuState(f.read())