-
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.
Making a discovery component helper module
- Loading branch information
1 parent
0beabd4
commit 91e50ba
Showing
3 changed files
with
54 additions
and
23 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,46 @@ | ||
from fauxfactory import gen_string | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope='module') | ||
def module_discovery_hostgroup(module_org, module_location, module_target_sat): | ||
host = module_target_sat.api.Host(organization=module_org, location=module_location) | ||
host.create_missing() | ||
return module_target_sat.api.HostGroup( | ||
organization=[module_org], | ||
location=[module_location], | ||
medium=host.medium, | ||
root_pass=gen_string('alpha'), | ||
operatingsystem=host.operatingsystem, | ||
ptable=host.ptable, | ||
domain=host.domain, | ||
architecture=host.architecture, | ||
).create() | ||
|
||
|
||
@pytest.fixture(scope='module') | ||
def discovery_org(module_org, module_target_sat): | ||
# Update default discovered host organization | ||
discovery_org = module_target_sat.api.Setting().search( | ||
query={'search': 'name="discovery_organization"'} | ||
)[0] | ||
default_discovery_org = discovery_org.value | ||
discovery_org.value = module_org.name | ||
discovery_org.update(['value']) | ||
yield module_org | ||
discovery_org.value = default_discovery_org | ||
discovery_org.update(['value']) | ||
|
||
|
||
@pytest.fixture(scope='module') | ||
def discovery_location(module_location, module_target_sat): | ||
# Update default discovered host location | ||
discovery_loc = module_target_sat.api.Setting().search( | ||
query={'search': 'name="discovery_location"'} | ||
)[0] | ||
default_discovery_loc = discovery_loc.value | ||
discovery_loc.value = module_location.name | ||
discovery_loc.update(['value']) | ||
yield module_location | ||
discovery_loc.value = default_discovery_loc | ||
discovery_loc.update(['value']) |
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