[BUG] Regression - Can't override profile settings via `cloud.profile` state function
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
There is a regression in the behavior of cloud.profile in salt v3007.0 in that you can no longer override or set the profile settings through kwargs passed to this function. This was working in 3006.7
Setup
To demonstrate we can use the saltify driver (though this behavior is expected to be reproducible with any driver).
- Install salt-minion, salt-master, and salt-cloud on a VM
- Setup another VM that the first VM can reach over ssh (to be salted with saltify)
The following state and configuration files were used.
# /etc/salt/cloud.providers.d/saltify.conf
saltify:
driver: saltify
# /etc/salt/cloud.profiles.d/salty.conf
salty:
ssh_host: 1.1.1.1
ssh_username: root
password: rootroot
provider: saltify
# /srv/salt/cloud.sls
saltify_instance:
cloud.profile:
- name: salt-remote-0
- profile: salty
- ssh_host: <ip-of-remote-vm>
- minion:
master: <ip-of-master-vm>
(replace the values in <> as appropriate)
Notice that the above configuration uses root login and password authentication to connect to the remote host, therefore you may need to apply the following configuration to/etc/ssh/sshd_config to allow for this, e.g.
PermitRootLogin yes
PasswordAuthentication yes
and then restart sshd
systemctl restart sshd
Steps to Reproduce the behavior
Run the state
salt-call state.sls cloud
By viewing debug logs on the minion you will observe that the profile override settings are not being used, e.g.
2024-04-23 17:19:02,583 [salt.cloud :1173][WARNING ][107468] There's no master defined on the 'salt-remote-0' VM settings.
2024-04-23 17:19:02,586 [salt.cloud :1178][DEBUG ][107468] Generating minion keys for 'salt-remote-0'
2024-04-23 17:19:05,793 [salt.loaded.int.clouds.saltify:312 ][INFO ][107468] Provisioning existing machine salt-remote-0
2024-04-23 17:19:05,804 [salt.loader.lazy :960 ][DEBUG ][107468] The functions from module 'cloud' are being loaded by dir() on the loaded module
2024-04-23 17:19:05,807 [salt.utils.lazy :99 ][DEBUG ][107468] LazyLoaded cloud.bootstrap
2024-04-23 17:19:05,810 [salt.loaded.int.utils.cloud:138 ][INFO ][107468] Rendering deploy script: /opt/saltstack/salt/lib/python3.10/site-packages/salt/cloud/deploy/bootstrap-salt.sh
2024-04-23 17:19:05,938 [asyncio :54 ][DEBUG ][107468] Using selector: EpollSelector
2024-04-23 17:19:05,940 [asyncio :54 ][DEBUG ][107468] Using selector: EpollSelector
2024-04-23 17:19:05,943 [salt.transport.tcp:1592][DEBUG ][107468] Publisher connecting to /var/run/salt/master/master_event_pull.ipc
2024-04-23 17:19:05,979 [salt.transport.tcp:1638][DEBUG ][107468] Closing _TCPPubServerPublisher instance
2024-04-23 17:19:05,980 [salt.loaded.int.utils.cloud:1512][DEBUG ][107468] Deploying 1.1.1.1 at 2024-04-23 17:19:05
2024-04-23 17:19:05,980 [salt.loaded.int.utils.cloud:740 ][DEBUG ][107468] Attempting connection to host 1.1.1.1 on port 22
On the contrary, you may repeat the above procedure on a salt v3006.7 installation and observe a successful deployment.
Expected behavior
Profile settings should be able to be set / overridden with cloud.profile as it did with prior versions of salt
Versions Report
Salt Version:
Salt: 3007.0
Python Version:
Python: 3.10.13 (main, Feb 19 2024, 03:31:20) [GCC 11.2.0]
Dependency Versions:
cffi: 1.16.0
cherrypy: 18.8.0
dateutil: 2.8.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.3
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.7
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 23.1
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: Not Installed
python-gnupg: 0.5.2
PyYAML: 6.0.1
PyZMQ: 25.1.2
relenv: 0.15.1
smmap: Not Installed
timelib: 0.3.0
Tornado: 6.3.3
ZMQ: 4.3.4
Salt Package Information:
Package Type: onedir
System Versions:
dist: ubuntu 22.04.2 jammy
locale: utf-8
machine: x86_64
release: 5.15.0-67-generic
system: Linux
version: Ubuntu 22.04.2 jammy
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the cloud.profile state entry point and reproduce the issue using /srv/salt/cloud.sls, the saltify provider/profile files, and salt-call state.sls cloud. Compare the behavior with Salt 3006.7 and 3007.0, then verify that ssh_host and minion settings passed as kwargs override the profile and that deployment completes without the missing-master warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100