Ejemplo n.º 1
0
 def test_password(self):
     # The controller admin password is correctly retrieved.
     with mock.patch('helpers.juju') as mock_juju:
         mock_juju.return_value = controller_info
         password = get_password()
     self.assertEqual('d409fc4ae870ab66292007ff9dfdd67f', password)
     mock_juju.assert_called_once_with(
         'show-controller', '--show-password', '--format', 'json')
Ejemplo n.º 2
0
        charm_source = os.path.join(os.path.dirname(__file__), '..')
    if series is None:
        series = os.getenv('SERIES', '').strip() or DEFAULT_SERIES
    logging.debug('setting up the charm')
    path = tempfile.mkdtemp()
    rsync(charm_source, path)
    args = ['deploy', '--series', series]
    if app_name is None:
        app_name = charm_name
    if options is not None:
        config_file = make_charm_config_file({app_name: options})
        args.extend(['--config', config_file.name])
    if force_machine is not None:
        args.extend(['--to', str(force_machine)])
    args.append(path)
    args.append(app_name)
    logging.debug('deploying {} (series: {}) from {}'.format(
        app_name, series, path))
    juju(*args)
    logging.debug('exposing {}'.format(app_name))
    juju('expose', app_name)
    logging.debug('waiting for the unit to be ready')
    return wait_for_unit(app_name)


if __name__ == '__main__':
    logging.getLogger().setLevel(logging.DEBUG)
    unit = juju_deploy('juju-gui')
    print(json.dumps(unit, indent=2))
    print('password: {}'.format(get_password()))
Ejemplo n.º 3
0
        charm_source = os.path.join(os.path.dirname(__file__), '..')
    if series is None:
        series = os.getenv('SERIES', '').strip() or DEFAULT_SERIES
    logging.debug('setting up the charm')
    path = tempfile.mkdtemp()
    rsync(charm_source, path)
    args = ['deploy', '--series', series]
    if app_name is None:
        app_name = charm_name
    if options is not None:
        config_file = make_charm_config_file({app_name: options})
        args.extend(['--config', config_file.name])
    if force_machine is not None:
        args.extend(['--to', str(force_machine)])
    args.append(path)
    args.append(app_name)
    logging.debug('deploying {} (series: {}) from {}'.format(
        app_name, series, path))
    juju(*args)
    logging.debug('exposing {}'.format(app_name))
    juju('expose', app_name)
    logging.debug('waiting for the unit to be ready')
    return wait_for_unit(app_name)


if __name__ == '__main__':
    logging.getLogger().setLevel(logging.DEBUG)
    unit = juju_deploy('juju-gui')
    print(json.dumps(unit, indent=2))
    print('password: {}'.format(get_password()))