mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 09:40:21 +00:00
No global variables
This commit is contained in:
parent
a8c640a6c3
commit
ca974fba21
1 changed files with 10 additions and 11 deletions
|
@ -2,16 +2,15 @@ import os
|
|||
import pytest
|
||||
import testinfra
|
||||
|
||||
if os.environ.get('KITCHEN_USERNAME') == 'vagrant':
|
||||
if 'windows' in os.environ.get('KITCHEN_INSTANCE'):
|
||||
test_host = testinfra.get_host('winrm://{KITCHEN_USERNAME}:{KITCHEN_PASSWORD}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ), no_ssl=True)
|
||||
else:
|
||||
test_host = testinfra.get_host('paramiko://{KITCHEN_USERNAME}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ),
|
||||
ssh_identity_file=os.environ.get('KITCHEN_SSH_KEY'))
|
||||
else:
|
||||
test_host = testinfra.get_host('docker://{KITCHEN_USERNAME}@{KITCHEN_CONTAINER_ID}'.format(**os.environ))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture(scope='session')
|
||||
def host():
|
||||
return test_host
|
||||
if os.environ.get('KITCHEN_USERNAME') == 'vagrant':
|
||||
if 'windows' in os.environ.get('KITCHEN_INSTANCE'):
|
||||
return testinfra.get_host(
|
||||
'winrm://{KITCHEN_USERNAME}:{KITCHEN_PASSWORD}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ),
|
||||
no_ssl=True)
|
||||
return testinfra.get_host(
|
||||
'paramiko://{KITCHEN_USERNAME}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ),
|
||||
ssh_identity_file=os.environ.get('KITCHEN_SSH_KEY'))
|
||||
return testinfra.get_host('docker://{KITCHEN_USERNAME}@{KITCHEN_CONTAINER_ID}'.format(**os.environ))
|
||||
|
|
Loading…
Add table
Reference in a new issue