當前位置: 首頁>>代碼示例>>Python>>正文


Python amulet.Deployment方法代碼示例

本文整理匯總了Python中amulet.Deployment方法的典型用法代碼示例。如果您正苦於以下問題:Python amulet.Deployment方法的具體用法?Python amulet.Deployment怎麽用?Python amulet.Deployment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在amulet的用法示例。


在下文中一共展示了amulet.Deployment方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUpClass

# 需要導入模塊: import amulet [as 別名]
# 或者: from amulet import Deployment [as 別名]
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'] 
開發者ID:juju-solutions,項目名稱:bundle-canonical-kubernetes,代碼行數:24,代碼來源:40-security-check.py

示例2: setUpClass

# 需要導入模塊: import amulet [as 別名]
# 或者: from amulet import Deployment [as 別名]
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) 
開發者ID:juju-solutions,項目名稱:bundle-canonical-kubernetes,代碼行數:22,代碼來源:20-charm-validation.py

示例3: setUpClass

# 需要導入模塊: import amulet [as 別名]
# 或者: from amulet import Deployment [as 別名]
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] 
開發者ID:juju-solutions,項目名稱:layer-packetbeat,代碼行數:19,代碼來源:10-deploy.py

示例4: setUpClass

# 需要導入模塊: import amulet [as 別名]
# 或者: from amulet import Deployment [as 別名]
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 
開發者ID:juju-solutions,項目名稱:layer-etcd,代碼行數:18,代碼來源:10-deploy.py

示例5: __init__

# 需要導入模塊: import amulet [as 別名]
# 或者: from amulet import Deployment [as 別名]
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() 
開發者ID:openstack,項目名稱:charm-plumgrid-gateway,代碼行數:11,代碼來源:deployment.py

示例6: _deploy

# 需要導入模塊: import amulet [as 別名]
# 或者: from amulet import Deployment [as 別名]
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 
開發者ID:openstack,項目名稱:charm-plumgrid-gateway,代碼行數:11,代碼來源:deployment.py

示例7: _deploy

# 需要導入模塊: import amulet [as 別名]
# 或者: from amulet import Deployment [as 別名]
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 
開發者ID:openstack,項目名稱:charm-swift-proxy,代碼行數:15,代碼來源:deployment.py

示例8: test_deploy

# 需要導入模塊: import amulet [as 別名]
# 或者: from amulet import Deployment [as 別名]
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] 
開發者ID:juju-solutions,項目名稱:layer-hadoop-client,代碼行數:8,代碼來源:01-basic-deployment.py

示例9: setUpClass

# 需要導入模塊: import amulet [as 別名]
# 或者: from amulet import Deployment [as 別名]
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) 
開發者ID:juju-solutions,項目名稱:bundle-canonical-kubernetes,代碼行數:14,代碼來源:30-unit-shuffle.py

示例10: setUpClass

# 需要導入模塊: import amulet [as 別名]
# 或者: from amulet import Deployment [as 別名]
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] 
開發者ID:juju-solutions,項目名稱:layer-ubuntu-devenv,代碼行數:10,代碼來源:01-deploy.py

示例11: __init__

# 需要導入模塊: import amulet [as 別名]
# 或者: from amulet import Deployment [as 別名]
def __init__(self, series="xenial", storage=True):
        self.series = series
        self.storage = storage
        self.deployment = Deployment(series=self.series)
        self._run_hooks("init") 
開發者ID:jenkinsci,項目名稱:jenkins-charm,代碼行數:7,代碼來源:deployment.py


注:本文中的amulet.Deployment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。