Skip to content

Commit

Permalink
Merge branch 'master' into nilclass-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
sambible authored Oct 9, 2023
2 parents f740a04 + 0ddb4b7 commit 708114a
Show file tree
Hide file tree
Showing 26 changed files with 512 additions and 772 deletions.
4 changes: 4 additions & 0 deletions conf/server.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ SERVER:
ADMIN_USERNAME: admin
# Admin password when accessing API and UI
ADMIN_PASSWORD: changeme
# Set to true to verify against the certificate given in REQUESTS_CA_BUNDLE
# Or specify path to certificate path or directory
# see: https://requests.readthedocs.io/en/latest/user/advanced/#ssl-cert-verification
VERIFY_CA: false

SSH_CLIENT:
# Specify port number for ssh client, Default: 22
Expand Down
36 changes: 17 additions & 19 deletions conf/vmware.yaml.template
Original file line number Diff line number Diff line change
@@ -1,33 +1,31 @@
VMWARE:
# Vmware to be added as a compute resource
# vmware vcenter URL, e.g. example.com
# VMware to be added as a compute resource
# VCENTER: vmware vcenter URL
VCENTER:
# Login for vmware
# USERNAME: Login for vmware
USERNAME:
# Password for vmware
# PASSWORD: Password for vmware
PASSWORD:
# vmware datacenter
# DATACENTER: vmware datacenter
DATACENTER:
# cluster: vmware cluster
# CLUSTER: vmware cluster
CLUSTER:
# Name of VM that should be used
# DATASTORE: vmware datastore
DATASTORE:
# VM_NAME: Name of VM to power On/Off & delete
VM_NAME:
# mac_address: Mac address of the vm
# MAC_ADDRESS: Mac address of the vm
MAC_ADDRESS:
# hypervisor: IP address of the hypervisor
# HYPERVISOR: IP address or hostname of the hypervisor
HYPERVISOR:


# Vmware Compute resource image data
# Operating system of the image
# VMware Compute resource image data
# IMAGE_OS: Operating system of the image
IMAGE_OS:
# Architecture of the image
# IMAGE_ARCH: Architecture of the image
IMAGE_ARCH:
# Login to the image
# IMAGE_USERNAME: Login to the image
IMAGE_USERNAME:
# Password of that user
# IMAGE_PASSWORD: Password to the image
IMAGE_PASSWORD:
# Image name on the external provider
# IMAGE_NAME: Image name on the external provider
IMAGE_NAME:
# Interface used for some tests; not required to work with provisioning, not required to be in VLAN
INTERFACE:
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
'pytest_fixtures.component.host',
'pytest_fixtures.component.hostgroup',
'pytest_fixtures.component.http_proxy',
'pytest_fixtures.component.katello_agent',
'pytest_fixtures.component.katello_certs_check',
'pytest_fixtures.component.lce',
'pytest_fixtures.component.maintain',
Expand All @@ -52,6 +51,7 @@
'pytest_fixtures.component.provision_gce',
'pytest_fixtures.component.provision_libvirt',
'pytest_fixtures.component.provision_pxe',
'pytest_fixtures.component.provision_vmware',
'pytest_fixtures.component.provisioning_template',
'pytest_fixtures.component.puppet',
'pytest_fixtures.component.repository',
Expand Down
57 changes: 0 additions & 57 deletions pytest_fixtures/component/katello_agent.py

This file was deleted.

59 changes: 59 additions & 0 deletions pytest_fixtures/component/provision_vmware.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from fauxfactory import gen_string
import pytest

from robottelo.config import settings


@pytest.fixture(scope='module')
def module_vmware_cr(module_provisioning_sat, module_sca_manifest_org, module_location):
vmware_cr = module_provisioning_sat.sat.api.VMWareComputeResource(
name=gen_string('alpha'),
provider='Vmware',
url=settings.vmware.vcenter,
user=settings.vmware.username,
password=settings.vmware.password,
datacenter=settings.vmware.datacenter,
organization=[module_sca_manifest_org],
location=[module_location],
).create()
return vmware_cr


@pytest.fixture
def module_vmware_hostgroup(
module_vmware_cr,
module_provisioning_sat,
module_sca_manifest_org,
module_location,
default_architecture,
module_provisioning_rhel_content,
module_lce_library,
default_partitiontable,
module_provisioning_capsule,
pxe_loader,
):
return module_provisioning_sat.sat.api.HostGroup(
name=gen_string('alpha'),
organization=[module_sca_manifest_org],
location=[module_location],
architecture=default_architecture,
domain=module_provisioning_sat.domain,
content_source=module_provisioning_capsule.id,
content_view=module_provisioning_rhel_content.cv,
compute_resource=module_vmware_cr,
kickstart_repository=module_provisioning_rhel_content.ksrepo,
lifecycle_environment=module_lce_library,
root_pass=settings.provisioning.host_root_password,
operatingsystem=module_provisioning_rhel_content.os,
ptable=default_partitiontable,
subnet=module_provisioning_sat.subnet,
pxe_loader=pxe_loader.pxe_loader,
group_parameters_attributes=[
# assign AK in order the hosts to be subscribed
{
'name': 'kt_activation_keys',
'parameter_type': 'string',
'value': module_provisioning_rhel_content.ak.name,
},
],
).create()
2 changes: 1 addition & 1 deletion requirements-optional.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# For running tests and checking code quality using these modules.
flake8==6.1.0
pytest-cov==4.1.0
redis==5.0.0
redis==5.0.1
pre-commit==3.4.0

# For generating documentation.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
betelgeuse==1.10.0
broker[docker]==0.4.1
cryptography==41.0.4
deepdiff==6.5.0
deepdiff==6.6.0
dynaconf[vault]==3.2.3
fauxfactory==3.1.0
jinja2==3.1.2
Expand Down
22 changes: 20 additions & 2 deletions robottelo/cli/discoveredhost.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,28 @@ class DiscoveredHost(Base):
def provision(cls, options=None):
"""Manually provision discovered host"""
cls.command_sub = 'provision'
return cls.execute(cls._construct_command(options))
return cls.execute(cls._construct_command(options), output_format='csv')

@classmethod
def facts(cls, options=None):
"""Get all the facts associated with discovered host"""
cls.command_sub = 'facts'
return cls.execute(cls._construct_command(options))
return cls.execute(cls._construct_command(options), output_format='csv')

@classmethod
def auto_provision(cls, options=None):
"""Auto provision discovered host"""
cls.command_sub = 'auto-provision'
return cls.execute(cls._construct_command(options), output_format='csv')

@classmethod
def reboot(cls, options=None):
"""Reboot discovered host"""
cls.command_sub = 'reboot'
return cls.execute(cls._construct_command(options), output_format='csv')

@classmethod
def refresh_facts(cls, options=None):
"""Refresh facts associated with discovered host"""
cls.command_sub = 'refresh-facts'
return cls.execute(cls._construct_command(options), output_format='csv')
6 changes: 4 additions & 2 deletions robottelo/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def user_nailgun_config(username=None, password=None):
"""
creds = (username, password)
return ServerConfig(get_url(), creds, verify=False)
return ServerConfig(get_url(), creds, verify=settings.server.verify_ca)


def setting_is_set(option):
Expand Down Expand Up @@ -153,7 +153,9 @@ def configure_nailgun():
from nailgun.config import ServerConfig

entity_mixins.CREATE_MISSING = True
entity_mixins.DEFAULT_SERVER_CONFIG = ServerConfig(get_url(), get_credentials(), verify=False)
entity_mixins.DEFAULT_SERVER_CONFIG = ServerConfig(
get_url(), get_credentials(), verify=settings.server.verify_ca
)
gpgkey_init = entities.GPGKey.__init__

def patched_gpgkey_init(self, server_config=None, **kwargs):
Expand Down
1 change: 1 addition & 0 deletions robottelo/config/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
Validator('server.port', default=443),
Validator('server.ssh_username', default='root'),
Validator('server.ssh_password', default=None),
Validator('server.verify_ca', default=False),
],
content_host=[
Validator('content_host.default_rhel_version', must_exist=True),
Expand Down
6 changes: 2 additions & 4 deletions robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1725,17 +1725,15 @@ class Colored(Box):
STRING_TYPES = ['alpha', 'numeric', 'alphanumeric', 'latin1', 'utf8', 'cjk', 'html']

VMWARE_CONSTANTS = {
'cluster': 'Satellite-Engineering',
'folder': 'vm',
'guest_os': 'Red Hat Enterprise Linux 7 (64-bit)',
'guest_os': 'Red Hat Enterprise Linux 8 (64-bit)',
'scsicontroller': 'LSI Logic Parallel',
'virtualhw_version': 'Default',
'pool': 'Resources',
'network_interface_name': 'VMXNET 3',
'datastore': 'Local-Ironforge',
'network_interfaces': 'qe_%s',
}


HAMMER_CONFIG = "~/.hammer/cli.modules.d/foreman.yml"
HAMMER_SESSIONS = "~/.hammer/sessions"

Expand Down
2 changes: 1 addition & 1 deletion robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,7 @@ class DecClass(cls):
self.nailgun_cfg = ServerConfig(
auth=(settings.server.admin_username, settings.server.admin_password),
url=f'{self.url}',
verify=False,
verify=settings.server.verify_ca,
)
# add each nailgun entity to self.api, injecting our server config
for name, obj in entities.__dict__.items():
Expand Down
1 change: 1 addition & 0 deletions tests/foreman/api/test_capsulecontent.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ def test_positive_sync_updated_repo(
cv = cv.read()
assert len(cv.version) == 2

cv.version.sort(key=lambda version: version.id)
cvv = cv.version[-1].read()
cvv.promote(data={'environment_ids': function_lce.id})
cvv = cvv.read()
Expand Down
Loading

0 comments on commit 708114a

Please sign in to comment.