Python amulet 模块,Deployment() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用amulet.Deployment()

项目:bundle-canonical-kubernetes    作者:juju-solutions    | 项目源码 | 文件源码
def setUpClass(cls):
        cls.deployment = amulet.Deployment(series='xenial')
        with open(cls.bundle_file) as stream:
            bundle_yaml = stream.read()
        bundle = yaml.safe_load(bundle_yaml)
        cls.deployment.load(bundle)

        # Allow some time for Juju to provision and deploy the bundle.
        cls.deployment.setup(timeout=SECONDS_TO_WAIT)

        # Wait for the system to settle down.
        wait(cls.deployment.sentry)

        # Make every unit available through self reference
        # eg: for worker in self.workers:
        #         print(worker.info['public-address'])
        cls.easyrsas = cls.deployment.sentry['easyrsa']
        cls.etcds = cls.deployment.sentry['etcd']
        cls.flannels = cls.deployment.sentry['flannel']
        cls.loadbalancers = cls.deployment.sentry['kubeapi-load-balancer']
        cls.masters = cls.deployment.sentry['kubernetes-master']
        cls.workers = cls.deployment.sentry['kubernetes-worker']
项目:bundle-canonical-kubernetes    作者:juju-solutions    | 项目源码 | 文件源码
def setUpClass(cls):
        cls.deployment = amulet.Deployment(series='xenial')
        with open(cls.bundle_file) as stream:
            bundle_yaml = stream.read()
        bundle = yaml.safe_load(bundle_yaml)
        if 'options' not in bundle['services']['kubernetes-worker']:
            labels = {'labels': "mylabel=thebest"}
            bundle['services']['kubernetes-worker']['options'] = labels
        else:
            if 'labels' not in bundle['services']['kubernetes-worker']['options']:
                bundle['services']['kubernetes-worker']['options']['labels'] = "mylabel=thebest"
            else:
                bundle['services']['kubernetes-worker']['options']['labels'] += " mylabel=thebest"
        cls.deployment.load(bundle)

        # Allow some time for Juju to provision and deploy the bundle.
        cls.deployment.setup(timeout=SECONDS_TO_WAIT)

        # Wait for the system to settle down.
        wait(cls.deployment.sentry)
项目:layer-packetbeat    作者:juju-solutions    | 项目源码 | 文件源码
def setUpClass(cls):
        """Setup the deployment for this class once and deploy."""
        cls.deployment = amulet.Deployment(series='xenial')

        cls.deployment.add('ubuntu')
        cls.deployment.add('packetbeat')
        cls.deployment.relate('ubuntu:juju-info', 'packetbeat:beats-host')

        try:
            cls.deployment.setup(timeout=seconds)
            cls.deployment.sentry.wait()
        except amulet.helpers.TimeoutError:
            message = "The deploy did not setup in {0} seconds".format(seconds)
            amulet.raise_status(amulet.SKIP, msg=message)
        except:
            raise
        cls.unit = cls.deployment.sentry['packetbeat'][0]
项目:layer-etcd    作者:juju-solutions    | 项目源码 | 文件源码
def setUpClass(cls):
        cls.d = amulet.Deployment(series='xenial')
        cls.d.add('etcd')
        cls.d.add('easyrsa', 'cs:~containers/easyrsa')
        cls.d.configure('etcd', {'channel': '3.0/stable'})
        cls.d.relate('easyrsa:client', 'etcd:certificates')
        cls.d.setup(timeout=1200)
        cls.d.sentry.wait_for_messages({'etcd':
                                        re.compile('Healthy*|Unhealthy*')})
        # cls.d.sentry.wait()
        cls.etcd = cls.d.sentry['etcd']
        # find the leader
        for unit in cls.etcd:
            leader_result = unit.run('is-leader')
            if leader_result[0] == 'True':
                cls.leader = unit
项目:charm-plumgrid-gateway    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-plumgrid-gateway    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        try:
            self.d.setup(timeout=900)
            self.d.sentry.wait(timeout=900)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(amulet.FAIL, msg="Deployment timed out")
        except Exception:
            raise
项目:charm-swift-proxy    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-swift-proxy    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-heat    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-heat    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-keystone    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-keystone    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-nova-compute    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-nova-compute    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-ceph-osd    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-ceph-osd    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-glance    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-glance    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-neutron-api    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-neutron-api    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-ceph-mon    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-ceph-mon    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-openstack-dashboard    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-openstack-dashboard    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-ceilometer    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-ceilometer    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:layer-hadoop-client    作者:juju-solutions    | 项目源码 | 文件源码
def test_deploy(self):
        self.d = amulet.Deployment(series='xenial')
        self.d.add('client', 'hadoop-client')
        self.d.setup(timeout=900)
        self.d.sentry.wait(timeout=1800)
        self.unit = self.d.sentry['client'][0]
项目:bundle-canonical-kubernetes    作者:juju-solutions    | 项目源码 | 文件源码
def setUpClass(cls):
        cls.deployment = amulet.Deployment(series='xenial')
        with open(cls.bundle_file) as stream:
            bundle_yaml = stream.read()
        bundle = yaml.safe_load(bundle_yaml)
        cls.deployment.load(bundle)

        # Allow some time for Juju to provision and deploy the bundle.
        cls.deployment.setup(timeout=SECONDS_TO_WAIT)

        # Wait for the system to settle down.
        wait(cls.deployment.sentry)
项目:charm-hacluster    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-hacluster    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-neutron-openvswitch    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-neutron-openvswitch    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-cinder-backup    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-cinder-backup    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:layer-ubuntu-devenv    作者:juju-solutions    | 项目源码 | 文件源码
def setUpClass(cls):
        cls.d = amulet.Deployment(series='xenial')
        cls.d.add('ubuntu-devenv', 'cs:xenial/ubuntu-devenv')
        cls.d.add('openjdk', 'cs:xenial/openjdk')
        cls.d.relate('ubuntu-devenv:java', 'openjdk:java')
        cls.d.setup(timeout=900)
        cls.d.sentry.wait(timeout=1800)
        cls.unit = cls.d.sentry['ubuntu-devenv'][0]
项目:charm-ceph    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-ceph    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-odl-controller    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-odl-controller    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-ceph-radosgw    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-ceph-radosgw    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-swift-storage    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-swift-storage    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:equlipse    作者:konono    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:equlipse    作者:konono    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:charm-rabbitmq-server    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-rabbitmq-server    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise
项目:jenkins-charm    作者:jenkinsci    | 项目源码 | 文件源码
def __init__(self, series="xenial", storage=True):
        self.series = series
        self.storage = storage
        self.deployment = Deployment(series=self.series)
        self._run_hooks("init")
项目:charm-percona-cluster    作者:openstack    | 项目源码 | 文件源码
def __init__(self, series=None):
        """Initialize the deployment environment."""
        self.series = None

        if series:
            self.series = series
            self.d = amulet.Deployment(series=self.series)
        else:
            self.d = amulet.Deployment()
项目:charm-percona-cluster    作者:openstack    | 项目源码 | 文件源码
def _deploy(self):
        """Deploy environment and wait for all hooks to finish executing."""
        timeout = int(os.environ.get('AMULET_SETUP_TIMEOUT', 900))
        try:
            self.d.setup(timeout=timeout)
            self.d.sentry.wait(timeout=timeout)
        except amulet.helpers.TimeoutError:
            amulet.raise_status(
                amulet.FAIL,
                msg="Deployment timed out ({}s)".format(timeout)
            )
        except Exception:
            raise