python / psf-salt

PSF infrastructure configuration
MIT License
111 stars 57 forks source link

"module.run" is using its deprecated version and will expire in version "Phosphorus" #298

Open ewdurbin opened 1 year ago

ewdurbin commented 1 year ago
[WARNING ] The function "module.run" is using its deprecated version and will expire in version "Phosphorus".

Some of our states use module.run which apparently is using a deprecated syntax.

We should determine what the call should look like and update all invocations in our states to silence this warning.

To reproduce, vagrant up the salt-master and then vagrant up a node that uses the module.run function such as cdn-logs.

ewdurbin commented 1 year ago

Little more investigation pairing with @cegerhardson, seems that this is only on the first invocation of state.highstate for some hosts. We also don't appear to using the module.run function directly. My best guess at this point is we're using it indirectly via a built-in salt state.

Attempted to get debug output by destroying cdn-logs vagrant box locally then bringing it back up with this patch applied:

diff --git a/Vagrantfile b/Vagrantfile
index 4763e96..671af6a 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -68,16 +68,16 @@ Vagrant.configure("2") do |config|
       apt-get install -y salt-minion
       echo 'master: #{MASTER1}\n' > /etc/salt/minion.d/local.conf
       service salt-minion restart
-      salt-call state.highstate
+      salt-call -l debug state.highstate
       while ! salt-call consul.cluster_ready | grep True; do echo 'waiting for consul'; sleep 1; done
       salt '*' saltutil.sync_all
       salt '*' saltutil.refresh_grains
       salt '*' saltutil.refresh_pillar wait=True timeout=30
-      salt-call state.highstate
+      salt-call -l debug state.highstate
     HEREDOC

     # Run this always, because we need to sync our states.
-    s_config.vm.provision :shell, inline: "salt-call state.highstate", run: "always"
+    s_config.vm.provision :shell, inline: "salt-call -l debug state.highstate", run: "always"
   end

   SERVERS.each_with_index do |server_c, num|

but didn't see debug output from vagrant up :/

cegerhardson commented 1 year ago

After further investigation with @ewdurbin, it appears clear that the warning is coming from an indirect use via a built-in salt state, as we are not using module.run anywhere directly in our configuration.

As an attempt to confirm this hypothesis, we updated salt to its latest configuration, which cleared out this warning.

index 1e214c8..efc696b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -45,8 +45,8 @@ RUN /usr/sbin/sshd

 # Setup Salt Common

-RUN wget --quiet -O /usr/share/keyrings/salt-archive-keyring.gpg https://repo.saltproject.io/py3/ubuntu/20.04/$(dpkg --print-architecture)/3004/salt-archive-keyring.gpg
-RUN echo "deb [signed-by=/usr/share/keyrings/salt-archive-keyring.gpg arch=$(dpkg --print-architecture)] https://repo.saltproject.io/py3/ubuntu/20.04/$(dpkg --print-architecture)/3004 focal main" > /etc/apt/sources.list.d/salt.list
+RUN wget --quiet -O /usr/share/keyrings/salt-archive-keyring.gpg https://repo.saltproject.io/py3/ubuntu/20.04/$(dpkg --print-architecture)/3005/salt-archive-keyring.gpg
+RUN echo "deb [signed-by=/usr/share/keyrings/salt-archive-keyring.gpg arch=$(dpkg --print-architecture)] https://repo.saltproject.io/py3/ubuntu/20.04/$(dpkg --print-architecture)/3005 focal main" > /etc/apt/sources.list.d/salt.list
 RUN apt-get update -y && apt-get install -y --no-install-recommends salt-minion
index ddacf3b..090ed28 100644
--- a/salt/base/salt.sls
+++ b/salt/base/salt.sls
@@ -22,8 +22,8 @@ salt-2018.3:
   pkgrepo.managed:
     - humanname: repo.saltstack.org
     {% if grains["oscodename"] == "focal" %}
-    - name: deb https://archive.repo.saltproject.io/py3/ubuntu/20.04/{{ grains["osarch"] }}/archive/3004 focal main
-    - key_url: https://archive.repo.saltproject.io/py3/ubuntu/20.04/{{ grains["osarch"] }}/archive/3004/salt-archive-keyring.gpg
+    - name: deb https://repo.saltproject.io/py3/ubuntu/20.04/{{ grains["osarch"] }}/archive/3005 focal main
+    - key_url: https://repo.saltproject.io/py3/ubuntu/20.04/{{ grains["osarch"] }}/archive/3005/salt-archive-keyring.gpg
     {% else %}
     - name: deb http://archive.repo.saltstack.com/py3/ubuntu/{{ grains["osrelease"] }}/{{ grains["osarch"] }}/2018.3 {{ grains["oscodename"] }} main
     - key_url: https://archive.repo.saltstack.com/py3/ubuntu/18.04/amd64/2018.3/SALTSTACK-GPG-KEY.pub

For now, this warning is not a concern and proves that when we do decide to upgrade to salt's release 3005 codename Phosphorous, none of our current configuration will fail upon updating salt.