Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] esxi_host values aren't correctly used #306

Open
waynew opened this issue Sep 27, 2022 · 0 comments
Open

[BUG] esxi_host values aren't correctly used #306

waynew opened this issue Sep 27, 2022 · 0 comments

Comments

@waynew
Copy link
Contributor

waynew commented Sep 27, 2022

Using a sample (new style) config:

saltext.vmware:
  host: host.example.com
  user: fnord
  password: my voice is my passport, verify me
  esxi_host:
    esxi.example.com:
      user: some_esxi_dude
      password: a totally different password

Running salt-call vmware_esxi.get_role View works, but salt-call vmware_esxi.get_role View esxi.example.com does not -- get_config is not
correctly getting the user/password from the esxi_host portion of the salt
config.

waynew added a commit to waynew/salt-ext-modules-vmware that referenced this issue Sep 27, 2022
waynew added a commit to waynew/salt-ext-modules-vmware that referenced this issue Sep 28, 2022
waynew added a commit that referenced this issue Oct 12, 2022
* add config layout ADR

* Add tests for utils.connect.get_service_instance

* Fix utils.connect.get_service_instance

Previously when using esxi_host or profiles, getting config values would
be problematic - either we'd use the wrong credentials or get
credentials from the wrong place. This has fixed the behavior to be
in-line with what we have documented:

- when connecting to vCenter, environment variables take precedence for
  host/user/password
- when connecting to ESXi, use the config values.
- if profiles are used, get ESXi credentials from the profile, rather
  than the top-level saltext.vmware config.

* Add esxi_host bug #306 changelog

* Add changelog, fix #256

* Fix esxi credentials

Previously we had a method that returned a user/pass, this new one
returns a dictionary. If we want the right values we've gotta get them
out. There also wasn't any test to correctly manage that, so...

* Convert missed service_instance calls

* Correctly use pillar/grains/conf for SI

Previously we were only checking config (__opts__ if it was provided).
However, we don't just want to check the toplevel opts, but we also want
to check grains and pillar info.

As documented, the correct order is:

- env vars
- minion config
- minion grains
- minion pillar

This does that for get_service_instance, though other functions probably
don't quite have that same thing going for them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant