Merge "New client for RHEL activation"

This commit is contained in:
Jenkins
2014-08-15 17:54:08 +00:00
committed by Gerrit Code Review
2 changed files with 39 additions and 1 deletions

View File

@@ -552,3 +552,20 @@ class LinuxClient(RemoteInstanceClient):
time.sleep(self.connection_timeout)
return tx_bytes
def check_rhel_activation(self):
"""
@summary: Returns boolean - true or false depending of the activation
if it is passed or failed
@return: Activation status
@rtype: bool
"""
status_of_activation = False
command = 'rhn_check -v'
echo_call = 'echo $?'
rhel_network_satellite = self.ssh_client.execute_command(command)
if rhel_network_satellite.stdout is '':
output = self.ssh_client.execute_command(echo_call)
if int(output.stdout) is 0:
status_of_activation = True
return status_of_activation

View File

@@ -195,7 +195,7 @@ class ImageBehaviors(BaseBehavior):
def read_non_inherited_metadata(self):
"""
@summary:Returns the non inherited metadata
@summary: Returns the non inherited metadata
@return: List for user data processing
@rtype: List
"""
@@ -207,3 +207,24 @@ class ImageBehaviors(BaseBehavior):
data = myfile.read()
non_inherited_metadata = data.split(",")
return non_inherited_metadata
def get_image_ids_by_name(self, search_name):
"""
@summary: Returns list of desired image ids
@param search_name: Name for group of images for example Red Hat
@type search_name: String
@return: List of image ids
@rtype: List
"""
all_images = self.images_client.list_images_with_detail()
if all_images.entity is None:
raise Exception(
"Response entity of list images with detail was not set. "
"Response was: {0}".format(all_images.content))
image_ids = []
for image in all_images.entity:
if search_name in image.name:
image_ids.append(image.id)
return image_ids