本文整理汇总了Python中tempest.common.utils.linux.remote_client.RemoteClient.can_authenticate方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteClient.can_authenticate方法的具体用法?Python RemoteClient.can_authenticate怎么用?Python RemoteClient.can_authenticate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tempest.common.utils.linux.remote_client.RemoteClient
的用法示例。
在下文中一共展示了RemoteClient.can_authenticate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_rebuild_server
# 需要导入模块: from tempest.common.utils.linux.remote_client import RemoteClient [as 别名]
# 或者: from tempest.common.utils.linux.remote_client.RemoteClient import can_authenticate [as 别名]
def test_rebuild_server(self):
""" The server should be rebuilt using the provided image and data """
meta = {'rebuild': 'server'}
new_name = rand_name('server')
file_contents = 'Test server rebuild.'
personality = [{'path': '/etc/rebuild.txt',
'contents': base64.b64encode(file_contents)}]
password = 'rebuildPassw0rd'
resp, rebuilt_server = self.client.rebuild(self.server_id,
self.image_ref_alt,
name=new_name, meta=meta,
personality=personality,
adminPass=password)
#Verify the properties in the initial response are correct
self.assertEqual(self.server_id, rebuilt_server['id'])
rebuilt_image_id = rebuilt_server['image']['id']
self.assertTrue(self.image_ref_alt.endswith(rebuilt_image_id))
self.assertEqual(self.flavor_ref, rebuilt_server['flavor']['id'])
#Verify the server properties after the rebuild completes
self.client.wait_for_server_status(rebuilt_server['id'], 'ACTIVE')
resp, server = self.client.get_server(rebuilt_server['id'])
rebuilt_image_id = rebuilt_server['image']['id']
self.assertTrue(self.image_ref_alt.endswith(rebuilt_image_id))
self.assertEqual(new_name, rebuilt_server['name'])
if self.run_ssh:
# Verify that the user can authenticate with the provided password
linux_client = RemoteClient(server, self.ssh_user, password)
self.assertTrue(linux_client.can_authenticate())
示例2: test_rebuild_server
# 需要导入模块: from tempest.common.utils.linux.remote_client import RemoteClient [as 别名]
# 或者: from tempest.common.utils.linux.remote_client.RemoteClient import can_authenticate [as 别名]
def test_rebuild_server(self):
# The server should be rebuilt using the provided image and data
meta = {"rebuild": "server"}
new_name = rand_name("server")
file_contents = "Test server rebuild."
personality = [{"path": "/etc/rebuild.txt", "contents": base64.b64encode(file_contents)}]
password = "rebuildPassw0rd"
resp, rebuilt_server = self.client.rebuild(
self.server_id, self.image_ref_alt, name=new_name, meta=meta, personality=personality, adminPass=password
)
# Verify the properties in the initial response are correct
self.assertEqual(self.server_id, rebuilt_server["id"])
rebuilt_image_id = rebuilt_server["image"]["id"]
self.assertTrue(self.image_ref_alt.endswith(rebuilt_image_id))
self.assertEqual(self.flavor_ref, int(rebuilt_server["flavor"]["id"]))
# Verify the server properties after the rebuild completes
self.client.wait_for_server_status(rebuilt_server["id"], "ACTIVE")
resp, server = self.client.get_server(rebuilt_server["id"])
rebuilt_image_id = rebuilt_server["image"]["id"]
self.assertTrue(self.image_ref_alt.endswith(rebuilt_image_id))
self.assertEqual(new_name, rebuilt_server["name"])
if self.run_ssh:
# Verify that the user can authenticate with the provided password
linux_client = RemoteClient(server, self.ssh_user, password)
self.assertTrue(linux_client.can_authenticate())
示例3: test_change_server_password
# 需要导入模块: from tempest.common.utils.linux.remote_client import RemoteClient [as 别名]
# 或者: from tempest.common.utils.linux.remote_client.RemoteClient import can_authenticate [as 别名]
def test_change_server_password(self):
"""The server's password should be set to the provided password"""
new_password = 'Newpass1234'
resp, body = self.client.change_password(self.server_id, new_password)
self.assertEqual(202, resp.status)
self.client.wait_for_server_status(self.server_id, 'ACTIVE')
if self.run_ssh:
# Verify that the user can authenticate with the new password
resp, server = self.client.get_server(self.server_id)
linux_client = RemoteClient(server, self.ssh_user, new_password)
self.assertTrue(linux_client.can_authenticate())
示例4: test_can_log_into_created_server
# 需要导入模块: from tempest.common.utils.linux.remote_client import RemoteClient [as 别名]
# 或者: from tempest.common.utils.linux.remote_client.RemoteClient import can_authenticate [as 别名]
def test_can_log_into_created_server(self):
sid = self.stack_identifier
rid = 'SmokeServer'
# wait for server resource create to complete.
self.client.wait_for_resource_status(sid, rid, 'CREATE_COMPLETE')
resp, body = self.client.get_resource(sid, rid)
self.assertEqual('CREATE_COMPLETE', body['resource_status'])
# fetch the IP address from servers client, since we can't get it
# from the stack until stack create is complete
resp, server = self.servers_client.get_server(
body['physical_resource_id'])
# Check that the user can authenticate with the generated password
linux_client = RemoteClient(
server, 'ec2-user', pkey=self.keypair['private_key'])
self.assertTrue(linux_client.can_authenticate())