cfme.utils.appliance package¶
Subpackages¶
Submodules¶
Module contents¶
-
class
cfme.utils.appliance.
Appliance
(provider_name, vm_name, browser_steal=False, container=None)[source]¶ Bases:
cfme.utils.appliance.IPAppliance
Appliance represents an already provisioned cfme appliance vm
Parameters: - provider_name – Name of the provider this appliance is running under
- vm_name – Name of the VM this appliance is running as
- browser_steal – Setting of the browser_steal attribute.
-
CONFIG_MAPPING
= {'vm_name': 'vm_name', 'provider_name': 'provider_name', 'container': 'container'}¶
-
CONFIG_NONGLOBAL
= set(['vm_name'])¶
-
address
¶
-
configure
(*args, **kwargs)¶
-
configure_fleecing
(*args, **kwargs)¶
-
ipapp
¶
-
is_on_rhev
¶
-
is_on_vsphere
¶
-
is_running
¶
-
provider
¶ Note
Cannot be cached because provider object is unpickable.
-
remove_rhev_direct_lun_disk
(*args, **kwargs)¶
-
rename
(new_name)[source]¶ Changes appliance name
Parameters: new_name – Name to set Note
Database must be up and running and evm service must be (re)started afterwards for the name change to take effect.
-
templatize
(seal=True)[source]¶ Marks the appliance as a template. Destroys the original VM in the process.
By default it runs the sealing process. If you have done it differently, you can opt out.
Parameters: seal – Whether to run the sealing process (making the VM ‘universal’).
-
vm_name
¶ VM’s name of the appliance on the provider
-
class
cfme.utils.appliance.
ApplianceConsole
(appliance)[source]¶ Bases:
object
ApplianceConsole is used for navigating and running appliance_console commands against an appliance.
-
class
cfme.utils.appliance.
ApplianceConsoleCli
(appliance)[source]¶ Bases:
object
-
configure_appliance_external_create
(region, dbhostname, username, password, dbname, fetch_key, sshlogin, sshpass)[source]¶
-
configure_appliance_external_join
(dbhostname, username, password, dbname, fetch_key, sshlogin, sshpass)[source]¶
-
-
exception
cfme.utils.appliance.
ApplianceException
[source]¶ Bases:
exceptions.Exception
-
class
cfme.utils.appliance.
DummyAppliance
[source]¶ Bases:
object
a dummy with minimal attribute set
-
__eq__
(other)¶ Automatically created by attrs.
-
__ge__
(other)¶ Automatically created by attrs.
-
__gt__
(other)¶ Automatically created by attrs.
-
__le__
(other)¶ Automatically created by attrs.
-
__lt__
(other)¶ Automatically created by attrs.
-
__ne__
(other)¶ Automatically created by attrs.
-
__repr__
()¶ Automatically created by attrs.
-
address
= '0.0.0.0'¶
-
browser_steal
= False¶
-
build
= 'missing :)'¶
-
is_downstream
= True¶
-
is_pod
= False¶
-
managed_known_providers
= []¶
-
version
= Version('5.8.0')¶
-
-
class
cfme.utils.appliance.
IPAppliance
(address=None, browser_steal=False, container=None, openshift_creds=None, db_host=None, db_port=None, ssh_port=None)[source]¶ Bases:
object
IPAppliance represents an already provisioned cfme appliance whos provider is unknown but who has an IP address. This has a lot of core functionality that Appliance uses, since it knows both the provider, vm_name and can there for derive the IP address.
Parameters: - ipaddress – The IP address of the provider
- browser_steal – If True then then current browser is killed and the new appliance is used to generate a new session.
- container – If the appliance is running as a container or as a pod, specifies its name.
- openshift_creds – If the appliance runs as a project on openshift, provides credentials for the openshift host so the framework can interact with the project.
- db_host – If the database is located somewhere else than on the appliance itself, specify the host here.
- db_port – Database port.
- ssh_port – SSH port.
-
CONFIG_MAPPING
= {'container': 'container', 'db_host': 'db_host', 'ssh_port': 'ssh_port', 'openshift_creds': 'openshift_creds', 'pod': 'container', 'db_port': 'db_port', 'base_url': 'address', 'browser_steal': 'browser_steal'}¶
-
CONFIG_NONGLOBAL
= set(['base_url'])¶
-
__call__
(**kwargs)[source]¶ Syntactic sugar for overriding certain instance variables for context managers.
Currently possible variables are:
- browser_steal
-
add_pglogical_replication_subscription
(host)[source]¶ Add a pglogical replication subscription without using the Web UI.
-
add_product_repo
(repo_url, **kwargs)[source]¶ - This method ensures that when we add a new repo URL, there will be no other version
- of such product present in the yum.repos.d. You can specify conf options in kwargs. They will be applied only to newly created repo file.
Returns: The repo id.
-
address
¶
-
appliance
¶
-
as_json
¶ Dumps the arguments that can create this appliance as a JSON. None values are ignored.
-
build
¶
-
build_date
¶
-
build_datetime
¶
-
clone_domain
(*args, **kwargs)¶
-
company_name
¶
-
configuration_details
¶ Return details that are necessary to navigate through Configuration accordions.
Parameters: ip_address – IP address of the server to match. If None, uses hostname from conf.env['base_url']
Returns: If the data weren’t found in the DB, NoneType
If the data were found, it returns tuple(region, server name, server id, server zone id)
-
configuration_details_old
¶
-
configure
(*args, **kwargs)¶
-
configure_appliance_for_openldap_ext_auth
(appliance_fqdn)[source]¶ - This method changes the /etc/sssd/sssd.conf and /etc/openldap/ldap.conf files to set
- up the appliance for an external authentication with OpenLdap. Apache file configurations are updated, for webui to take effect.
Parameters: appliance_name – FQDN for the appliance.
-
configure_gce
(*args, **kwargs)¶
-
configure_vm_console_cert
(*args, **kwargs)¶
-
coverage
¶
-
db
¶
-
default_zone
¶
-
deploy_merkyl
(*args, **kwargs)¶
-
diagnose_evm_failure
()[source]¶ Go through various EVM processes, trying to figure out what fails
Returns: A string describing the error, or None if no errors occurred.
This is intended to be run after an appliance is configured but failed for some reason, such as in the template tester.
-
enable_embedded_ansible_role
()[source]¶ Enables embbeded ansible role
This is necessary because server_roles does not wait long enough
-
event_listener
()[source]¶ Returns an instance of the event listening class pointed to this appliance.
-
evm_id
¶
-
evmserverd
¶
-
find_product_repos
()[source]¶ Returns a dictionary of products, where the keys are names of product (repos) and values are dictionaries where keys are the versions and values the names of the repositories.
-
fix_ntp_clock
(*args, **kwargs)¶
-
get_host_address
¶
-
get_repofile_list
()[source]¶ Returns list of repofiles present at the appliance.
Ignores certain files, like redhat.repo.
-
guid
¶
-
has_cli
¶
-
hostname
¶
-
install_netapp_sdk
(*args, **kwargs)¶
-
install_vddk
(*args, **kwargs)¶
-
is_downstream
¶
-
is_embedded_ansible_running
¶
-
is_embedded_ensible_role_enabled
¶
-
is_evm_service_running
(*args, **kwargs)¶
-
is_idle
¶ Return appliance idle state measured by last production.log activity. It runs one liner script, which first gathers current date on appliance and then gathers date of last entry in production.log(which has to be parsed) with /api calls filtered (These calls occur every minute.) Then it deducts that last time in log from current date and if it is lower than idle_time it returns False else True.
Args:
Returns: True if appliance is idling for longer or equal to idle_time seconds. False if appliance is not idling for longer or equal to idle_time seconds.
-
is_miqqe_patch_candidate
¶
-
is_nginx_running
¶
-
is_rabbitmq_running
¶
-
is_registration_complete
(used_repo_or_channel)[source]¶ Checks if an appliance has the correct repos enabled with RHSM or SAT6
-
is_ssh_running
¶
-
is_storage_enabled
¶
-
is_supervisord_running
¶
-
is_web_ui_running
(unsure=False)[source]¶ Triple checks if web UI is up and running
Parameters: unsure – Variable to return when not sure if web UI is running or not (default False
)
-
log
¶
-
managed_known_providers
¶ Returns a set of provider crud objects of known providers managed by this appliance
Note
Recognized by name only.
-
managed_provider_names
¶ Returns a list of names for all providers configured on the appliance
Note
Unlike
managed_known_providers
, this will also return names of providers that were not recognized, but are present.
-
miqqe_patch_applied
¶
-
miqqe_version
¶ Returns version of applied JS patch or None if not present
-
new_rest_api_instance
(entry_point=None, auth=None, logger='default', verify_ssl=False)[source]¶ Returns new REST API instance.
-
os_version
¶
-
patch_with_miqqe
(*args, **kwargs)¶
-
precompile_assets
(*args, **kwargs)¶
-
product_name
¶
-
product_url_regexp
= <_sre.SRE_Pattern object at 0x3af6900>¶
-
reboot
(*args, **kwargs)¶
-
rest_api
¶
-
rest_logger
¶
-
restart_evm_service
(*args, **kwargs)¶
-
scheme
¶
-
server
¶
-
server_roles
¶ Return a dictionary of server roles from database
-
set_cap_and_util_all_via_rails
()[source]¶ Turns on Collect for All Clusters and Collect for all Datastores without using Web UI.
-
set_cfme_server_relationship
(vm_name, server_id=1)[source]¶ Set MiqServer record to the id of a VM by name, effectively setting the CFME Server Relationship without using the Web UI.
-
set_pglogical_replication
(replication_type=':none')[source]¶ Set pglogical replication type (:none, :remote, :global) without using the Web UI.
-
set_rubyrep_replication
(host, port=5432, database='vmdb_production', username='root', password=None)[source]¶ Sets up rubyrep replication via advanced configuration settings yaml.
-
set_session_timeout
(timeout=86400, quiet=True)[source]¶ Sets the timeout of UI timeout.
Parameters: - timeout – Timeout in seconds
- quiet – Whether to ignore any errors
-
ssh_client
¶ Creates an ssh client connected to this appliance
Returns: A configured :py:class:
utils.ssh.SSHClient
instance.Usage:
with appliance.ssh_client as ssh: status, output = ssh.run_command('...')
Note
The credentials default to those found under
ssh
key incredentials.yaml
.
-
start_evm_service
(*args, **kwargs)¶
-
stop_evm_service
(*args, **kwargs)¶
-
swap
¶ Retrieves the value of swap for the appliance. Might raise an exception if SSH fails.
Returns: An integer value of swap in the VM in megabytes. If None
is returned, it means it was not possible to parse the command output.Raises: paramiko.ssh_exception.SSHException
orsocket.error
-
ui_port
¶
-
uninstall_vddk
(*args, **kwargs)¶
-
unpartitioned_disks
¶ Returns a list of disk devices that are not mounted.
-
update_guid
(*args, **kwargs)¶
-
update_rhel
(*args, **kwargs)¶
-
url
¶
-
use_dev_branch
(*args, **kwargs)¶
-
user
¶
-
version
¶
-
wait_for_embedded_ansible
(timeout=900)[source]¶ Waits for embedded ansible to be ready
Parameters: timeout – Number of seconds to wait until timeout (default 900
)
-
wait_for_evm_service
(*args, **kwargs)¶
-
wait_for_miq_server_workers_started
(evm_tail=None, poll_interval=5)[source]¶ Waits for the CFME’s workers to be started by tailing evm.log for: ‘INFO – : MIQ(MiqServer#wait_for_started_workers) All workers have been started’
-
wait_for_ssh
(timeout=600)[source]¶ Waits for appliance SSH connection to be ready
Parameters: timeout – Number of seconds to wait until timeout (default 600
)
-
wait_for_web_ui
(*args, **kwargs)¶
-
workaround_missing_gemfile
(*args, **kwargs)¶
-
write_repofile
(repo_id, repo_url, **kwargs)[source]¶ Wrapper around writing a repofile. You can specify conf options in kwargs.
-
zone_description
¶
-
class
cfme.utils.appliance.
MiqApi
(entry_point, auth, logger=None, verify_ssl=True, ca_bundle_path=None)[source]¶ Bases:
manageiq_client.api.ManageIQClient
Bases:
object
NavigatableMixin ensures that an object can navigate properly
The NavigatableMixin object ensures that a Collection/Entity object inside the framework has access to be able to create a Widgetastic View, and that it has access to the browser.
- Note: The browser access will have to change once proliferation of the Sentaku
- system becomes common place
-
cfme.utils.appliance.
load_appliances
(appliance_list, global_kwargs)[source]¶ Instantiate a list of appliances from configuration data.
Parameters: - appliance_list – List of dictionaries that contain parameters for
IPAppliance
- global_kwargs – Arguments that will be defined for each appliances. Appliance can override.
- Result:
- List of
IPAppliance
- appliance_list – List of dictionaries that contain parameters for
-
cfme.utils.appliance.
load_appliances_from_config
(config)[source]¶ Backwards-compatible config loader.
The
config
contains some global values andappliances
key which contains a list of dicts that have the same keys asIPAppliance.CONFIG_MAPPING
‘s keys. Ifappliances
key is not present, it is assumed it is old-format definition and the whole dict is used as a reference for one single appliance.The global values in the root of the dict (in case of
appliances
present) have lesser priority than the values in appliance definitions themselvesParameters: config – A dictionary with the configuration
-
cfme.utils.appliance.
provision_appliance
(version=None, vm_name_prefix='cfme', template=None, provider_name=None, vm_name=None)[source]¶ Provisions fresh, unconfigured appliance of a specific version
Note
Version must be mapped to template name under
appliance_provisioning > versions
incfme_data.yaml
. If no matching template for given version is found, and trackerbot is set up, the latest available template of the same stream will be used. E.g.: if there is no template for 5.5.5.1 but there is 5.5.5.3, it will be used instead. If both template name and version are specified, template name takes priority.Parameters: - version – version of appliance to provision
- vm_name_prefix – name prefix to use when deploying the appliance vm
Returns: Unconfigured appliance; instance of
Appliance
Usage:
my_appliance = provision_appliance('5.5.1.8', 'my_tests') my_appliance.fix_ntp_clock() ...other configuration... my_appliance.db.enable_internal() my_appliance.wait_for_web_ui() or my_appliance = provision_appliance('5.5.1.8', 'my_tests') my_appliance.configure()