Closed ryanwalder closed 6 years ago
@sjorge Probably needs tagging.
Can you try again after you have removed @real_memoize
from the is_supported function in salt.utils.zfs?
So I edited /usr/lib/python2.7/dist-packages/salt/utils/zfs.py
then removed /usr/lib/python2.7/dist-packages/salt/utils/zfs.pyc
and started the salt-master. Assuming this works (in lieu of an actual salt dev environment).
Removing @real_memoize
from above is_supported
did not work (same formula as above).
It needs to be done on the minion running the state. (Although that could be the same host in your case)
If that did not do it, i’m not really sure why it would not properly reload it then.
@ch3ll (hope tagging works because i’m on my phone)
Any ideas? I’m not super familiar with how all the reloading of grains/modules works inside a state run.
Ah, my bad. I did it on the master previously.
Just so my process is clear (if wrong please correct me, I have no real experience hacking on salt):
git 2018.3
/usr/lib/python2.7/dist-packages/salt/utils/zfs.py
to remove @real_memoize
from above is_supported
(line 282)/usr/lib/python2.7/dist-packages/salt/utils/zfs.pyc
salt-call state.apply zfs
(the above formula)Doesn't work :(
Debug log (looks the same unless I'm missing something) : https://www.hastebin.com/korojenafu
just to clarify is it working the second time you run the state.appy or only on the first run? I would suspect reloading the grains is all it would take, so I want to verify that its working on the next runs.
That's correct @Ch3LL.
First run installs the package but does not reload the grains/module as expected with reload_grains
/reload_modules
A second state.apply
right after the first has finished (and installed the zfsutils-linux
) package works as expected: The zfs_available
grain now returns True
which allows the module to load and the state.apply
to run correctly.
ping @saltstack/team-core i'm not seeing why this would not be reloading the grain. any ideas here?
@Ch3LL maybe because the ZFS grains are in salt/grains/zfs.py and not salt/grains/core.py ?
@ryanwalder can you try this fix:
diff --git a/salt/utils/zfs.py b/salt/utils/zfs.py
index 4988824..b37d552 100644
--- a/salt/utils/zfs.py
+++ b/salt/utils/zfs.py
@@ -279,7 +279,6 @@ def _command(source, command, flags=None, opts=None,
return ' '.join(cmd)
-@real_memoize
def is_supported():
'''
Check the system for ZFS support
@@ -302,7 +301,7 @@ def is_supported():
on_supported_platform = True
# Additional check for the zpool command
- return (_zpool_cmd() and on_supported_platform) is True
+ return (salt.utils.which('zpool') and on_supported_platform) is True
@sjorge and i worked offline with this approach. I believe it will work for you :)
@Ch3LL & @sjorge That works a treat. Great work!
Thanks for testing it :) I pushed the PR in #47518
Description of Issue/Question
Unable to reload the zfs module during a state run.
Expected behaviour
state.apply
state.apply
finishesActual behaviour
zfs_available
grain is not updated)state.apply
finishesstate.apply
again and it worksDebug log: https://www.hastebin.com/himapiladu
Looks like it's unable to reload and activate the module due to relying on the grain
zfs_support
which is not being updated, changing the order ofreload_modules
andreload_grains
in the below formula has no effect.Setup
Steps to Reproduce Issue
Use the above
Versions Report