本文整理匯總了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']
示例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)
示例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]
示例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
示例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()
示例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
示例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
示例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]
示例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)
示例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]
示例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")