-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[6.14.z] UI Utils module depreciation and new ui_factory module (#12641)
UI Utils module depreciation and new ui_factory module (#12225) Depreciation of UI Utils (cherry picked from commit ab21023) Co-authored-by: Jitendra Yejare <[email protected]>
- Loading branch information
1 parent
16c1319
commit a038b3d
Showing
5 changed files
with
75 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
""" | ||
It is not meant to be used directly, but as part of a robottelo.hosts.Satellite instance | ||
Need to pass the existing session object to the ui_factory method as a parameter | ||
example: my_satellite.ui_factory(session).ui_method() | ||
""" | ||
from fauxfactory import gen_string | ||
|
||
from robottelo.constants import DEFAULT_CV | ||
from robottelo.constants import ENVIRONMENT | ||
|
||
|
||
class UIFactory: | ||
"""This class is part of a mixin and not to be used directly. See robottelo.hosts.Satellite""" | ||
|
||
def __init__(self, satellite, session=None): | ||
self._satellite = satellite | ||
self._session = session | ||
|
||
def create_fake_host( | ||
self, | ||
host, | ||
interface_id=gen_string('alpha'), | ||
global_parameters=None, | ||
host_parameters=None, | ||
extra_values=None, | ||
new_host_details=False, | ||
): | ||
if extra_values is None: | ||
extra_values = {} | ||
os_name = f'{host.operatingsystem.name} {host.operatingsystem.major}' | ||
name = host.name if host.name is not None else gen_string('alpha').lower() | ||
values = { | ||
'host.name': name, | ||
'host.organization': host.organization.name, | ||
'host.location': host.location.name, | ||
'host.lce': ENVIRONMENT, | ||
'host.content_view': DEFAULT_CV, | ||
'operating_system.architecture': host.architecture.name, | ||
'operating_system.operating_system': os_name, | ||
'operating_system.media_type': 'All Media', | ||
'operating_system.media': host.medium.name, | ||
'operating_system.ptable': host.ptable.name, | ||
'operating_system.root_password': host.root_pass, | ||
'interfaces.interface.interface_type': 'Interface', | ||
'interfaces.interface.device_identifier': interface_id, | ||
'interfaces.interface.mac': host.mac, | ||
'interfaces.interface.domain': host.domain.name, | ||
'interfaces.interface.primary': True, | ||
'interfaces.interface.interface_additional_data.virtual_nic': False, | ||
'parameters.global_params': global_parameters, | ||
'parameters.host_params': host_parameters, | ||
'additional_information.comment': 'Host with fake data', | ||
} | ||
values.update(extra_values) | ||
if new_host_details: | ||
self._session.host_new.create(values) | ||
else: | ||
self._session.host.create(values) | ||
return f'{name}.{host.domain.name}' |
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters