vcenter provider: do not set env var

Some secrets are exposed because of the environment variables. The
Ansible variables are now enough, we don't need to expose the envvar
anymore.
This commit is contained in:
Gonéri Le Bouder 2020-01-09 10:12:12 -05:00
parent d64b49e8a0
commit 16d3f6bcbb

View file

@ -245,11 +245,7 @@ class VcenterEnvironment(CloudEnvironment):
parser = ConfigParser() parser = ConfigParser()
parser.read(self.config_path) # Worldstream and static parser.read(self.config_path) # Worldstream and static
# Most of the test cases use ansible_vars, but we plan to refactor these env_vars = dict()
# to use env_vars, output both for now
env_vars = dict(
(key.upper(), value) for key, value in parser.items('DEFAULT', raw=True))
ansible_vars = dict( ansible_vars = dict(
resource_prefix=self.resource_prefix, resource_prefix=self.resource_prefix,
) )
@ -263,6 +259,9 @@ class VcenterEnvironment(CloudEnvironment):
ansible_vars = dict( ansible_vars = dict(
vcsim=self._get_cloud_config('vcenter_hostname'), vcsim=self._get_cloud_config('vcenter_hostname'),
vcenter_hostname=self._get_cloud_config('vcenter_hostname'),
vcenter_username='user',
vcenter_password='pass',
) )
for key, value in ansible_vars.items(): for key, value in ansible_vars.items():
@ -274,10 +273,10 @@ class VcenterEnvironment(CloudEnvironment):
ansible_vars=ansible_vars, ansible_vars=ansible_vars,
module_defaults={ module_defaults={
'group/vmware': { 'group/vmware': {
'hostname': env_vars['VCENTER_HOSTNAME'], 'hostname': ansible_vars['vcenter_hostname'],
'username': env_vars['VCENTER_USERNAME'], 'username': ansible_vars['vcenter_username'],
'password': env_vars['VCENTER_PASSWORD'], 'password': ansible_vars['vcenter_password'],
'validate_certs': env_vars.get('VMWARE_VALIDATE_CERTS', 'no'), 'validate_certs': ansible_vars.get('vmware_validate_certs', 'no'),
}, },
}, },
) )