From b80d207ecaec9b582cd5f589cc63d78c11456c14 Mon Sep 17 00:00:00 2001 From: David Moore Date: Thu, 30 May 2024 09:38:13 -0400 Subject: [PATCH] docstring fails --- robottelo/constants/__init__.py | 2 +- robottelo/host_helpers/api_factory.py | 126 ++++++++++++++------------ 2 files changed, 70 insertions(+), 58 deletions(-) diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index ef3c862105..f59df86dc1 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -807,7 +807,7 @@ REAL_RHEL7_0_ERRATA_ID = 'RHBA-2020:3615' # for REAL_RHEL7_0_0_PACKAGE REAL_RHEL7_1_ERRATA_ID = 'RHBA-2017:0395' # tcsh bug fix update REAL_RHEL8_1_ERRATA_ID = 'RHSA-2022:4867' # for REAL_RHEL8_1_PACKAGE -REAL_RHEL8_ERRATA_CVES = ['CVE-2021-27023' , 'CVE-2021-27025'] +REAL_RHEL8_ERRATA_CVES = ['CVE-2021-27023', 'CVE-2021-27025'] FAKE_1_YUM_REPOS_COUNT = 32 FAKE_3_YUM_REPOS_COUNT = 78 FAKE_9_YUM_SECURITY_ERRATUM = [ diff --git a/robottelo/host_helpers/api_factory.py b/robottelo/host_helpers/api_factory.py index bf2ab7a378..fad4c65ba5 100644 --- a/robottelo/host_helpers/api_factory.py +++ b/robottelo/host_helpers/api_factory.py @@ -724,71 +724,83 @@ def register_host_and_needed_setup( loc=None, ): """ - * Helper will setup desired entities to host content. Then, register the + Helper will setup desired entities to host content. Then, register the host client to the entities, using associated activation-key. - * Attempt to make needed associations between detached entities. + Attempt to make needed associations between detached entities. - * Add desired repos to the content-view prior to calling this helper. + Add desired repos to the content-view prior to calling this helper. Or, add them to content-view after calling, then publish/promote. - * The host will be registered to location: None (visible to all locations). - - param client: instance of a rhel contenthost to register. - - param enable_repos (bool): enable all available repos on the client, after registration? - default: False, be sure to enable any repo(s) for client, after calling this method. - - param rex_key (bool): add a Remote Execution Key to client for satellite? - default: False - - param force (bool): force registration of the client to bypass? - default: False, a reused fixture contenthost will fail if already registered. - - param loc: pass a location object to limit host visibility. - default None, client is available to all locations. - - type: Below arguments can be any of the following: - * (int): pass id of entity to be read - * (str): pass name of entity to be searched - * (entity): pass an entity instance - param organization: pass an Organization instance, name, or id to use. - param activation_key: pass an Activation-Key instance, name, or id. - param environment: pass a Lifecycle-Environment instance, name, or id. - example: can pass string name 'Library'. - param content_view: pass a Content-View instance, name, or id. - example: can pass string name 'Default Organization View'. - - Notes: - 1. Will fail if passed entities do not exist in the same organization and satellite. - 2. Use param `enable_repos`, to try enabling any repositories on client, - that were added to content-view prior. But if there are no - repositories added/made available, this will fail. - 3. The 'Default Organization View' cannot be published, promoted, edited, or deleted. - but you can register the client to it. + The host will be registered to location: None (visible to all locations). + + Parameters: + client : instance + An instance of a RHEL content host to register. + enable_repos : bool, optional + Enable all available repos on the client after registration? Default is False. + Be sure to enable any repo(s) for the client after calling this method. + rex_key : bool, optional + Add a Remote Execution Key to the client for satellite? Default is False. + force : bool, optional + Force registration of the client to bypass? Default is False. + A reused fixture content host will fail if already registered. + loc : object, optional + Pass a location object to limit host visibility. Default is None, + making the client available to all locations. + + The following arguments can be any of the following types: + - int: pass the id of the entity to be read + - str: pass the name of the entity to be searched + - entity: pass an entity instance + + organization : int, str, or entity + Pass an Organization instance, name, or id to use. + activation_key : int, str, or entity + Pass an Activation-Key instance, name, or id. + environment : int, str, or entity + Pass a Lifecycle-Environment instance, name, or id. + Example: can pass string name 'Library'. + content_view : int, str, or entity + Pass a Content-View instance, name, or id. + Example: can pass string name 'Default Organization View'. + + Notes + ----- + 1. Will fail if passed entities do not exist in the same organization and satellite. + 2. Use param `enable_repos` to try enabling any repositories on the client + that were added to the content-view prior. But if there are no + repositories added/made available, this will fail. + 3. The 'Default Organization View' cannot be published, promoted, edited, or deleted, + but you can register the client to it. Steps: - 1. get needed entities from arguments, id, name, or instance. Read all as instance. - 2. publish the content-view if no versions exist, or needs_publish. - 3. promote the newest content-view-version if not in environment already. Skip for 'Library'. - 4. assign environment and content-view to the activation-key, if not associated. - 5. If desired, enable all repositories from content-view, for activation-key. - 6. Register the host, using the activation-key associated with content. - 7. Add a rex_key to the client if desired - - return: if Succeeded: dict containing the updated entities: - { - 'result', 'client', 'organization', 'activation_key', - 'environment', 'content_view', - } - - return: if Failed: dict containing the result and reason - { - 'result': 'error' - 'client': None, unless registration was successful - 'message': Details of failure encountered - } + 1. Get needed entities from arguments (id, name, or instance). Read all as instance. + 2. Publish the content-view if no versions exist or needs_publish. + 3. Promote the newest content-view-version if not in the environment already. Skip for 'Library'. + 4. Assign environment and content-view to the activation-key if not associated. + 5. If desired, enable all repositories from content-view for activation-key. + 6. Register the host using the activation-key associated with the content. + 7. Add a rex_key to the client if desired. + + Returns: dict + If succeeded: + { + 'result': 'success', + 'client': client, + 'organization': entities['Organization'], + 'activation_key': entities['ActivationKey'], + 'environment': entities['LifecycleEnvironment'], + 'content_view': entities['ContentView'], + } + If failed: + { + 'result': 'error', + 'client': None, unless registration was successful, + 'message': Details of the failure encountered, + } """ + method_error = { 'result': 'error', 'client': None,