本文整理匯總了Python中fuelweb_test.models.nailgun_client.NailgunClient.run_update方法的典型用法代碼示例。如果您正苦於以下問題:Python NailgunClient.run_update方法的具體用法?Python NailgunClient.run_update怎麽用?Python NailgunClient.run_update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fuelweb_test.models.nailgun_client.NailgunClient
的用法示例。
在下文中一共展示了NailgunClient.run_update方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: FuelWebClient
# 需要導入模塊: from fuelweb_test.models.nailgun_client import NailgunClient [as 別名]
# 或者: from fuelweb_test.models.nailgun_client.NailgunClient import run_update [as 別名]
#.........這裏部分代碼省略.........
for test in element if test.get(test_name) == 'success']
[failed_count.append(test)
for test in element if test.get(test_name) == 'failure']
[failed_count.append(test)
for test in element if test.get(test_name) == 'error']
if not checks:
assert_true(
len(passed_count) == test_retries,
'not all retries were successful,'
' fail {0} retries'.format(len(failed_count)))
else:
return failed_count
def get_nailgun_version(self):
logger.info("ISO version: %s" % self.client.get_api_version())
@logwrap
def sync_ceph_time(self, cluster_id):
cluster_nodes = self.client.list_cluster_nodes(cluster_id)
ceph_nodes_ips = [n['ip'] for n in cluster_nodes if 'ceph-osd' in
n['roles']]
self.environment.sync_time_admin_node()
if OPENSTACK_RELEASE_UBUNTU in OPENSTACK_RELEASE:
cmd = 'service ceph-all restart'
else:
cmd = 'service ceph restart'
for node_ip in ceph_nodes_ips:
remote = self.environment.get_ssh_to_remote(node_ip)
self.environment.sync_node_time(remote)
result = remote.execute(cmd)
if not result['exit_code'] == 0:
raise Exception('Ceph restart failed on {0}: {1}'.
format(node_ip, result['stderr']))
@logwrap
def get_releases_list_for_os(self, release_name):
full_list = self.client.get_releases()
release_ids = []
for release in full_list:
if release_name in release["name"]:
release_ids.append(release['id'])
return release_ids
@logwrap
def update_cluster(self, cluster_id, data):
logger.debug(
"Try to update cluster with data {0}".format(data))
self.client.update_cluster(cluster_id, data)
@logwrap
def run_update(self, cluster_id, timeout, interval):
logger.info("Run update..")
task = self.client.run_update(cluster_id)
logger.debug("Invocation of update runs with result {0}".format(task))
self.assert_task_success(task, timeout=timeout, interval=interval)
@logwrap
def get_cluster_release_id(self, cluster_id):
data = self.client.get_cluster(cluster_id)
return data['release_id']
def assert_nodes_in_ready_state(self, cluster_id):
for nailgun_node in self.client.list_cluster_nodes(cluster_id):
assert_equal(nailgun_node['status'], 'ready',
'Nailgun node status is not ready but {0}'.format(
nailgun_node['status']))
@logwrap
def manual_rollback(self, remote, rollback_version):
remote.execute('rm /etc/supervisord.d/current')
remote.execute('ln -s /etc/supervisord.d/{0}/'
'/etc/supervisord.d/current'.format(rollback_version))
remote.execute('rm /etc/fuel/version.yaml')
remote.execute('ln -s /etc/fuel/{0}/version.yaml'
'/etc/fuel/version.yaml'.format(rollback_version))
remote.execute('rm /var/www/nailgun/bootstrap')
remote.execute('ln -s /var/www/nailgun/{}_bootstrap'.
format(rollback_version))
logger.debug('stopping supervisor')
try:
remote.execute('/etc/init.d/supervisord stop')
except Exception as e:
logger.debug('exception is {0}'.format(e))
logger.debug('stop docker')
try:
remote.execute('docker stop $(docker ps -q)')
except Exception as e:
logger.debug('exception is {0}'.format(e))
logger.debug('start supervisor')
time.sleep(60)
try:
remote.execute('/etc/init.d/supervisord start')
except Exception as e:
logger.debug('exception is {0}'.format(e))
time.sleep(60)
@logwrap
def modify_python_file(self, remote, modification, file):
remote.execute('sed -i "{0}" {1}'.format(modification, file))