-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
salt.modules.pdbedit doesn't work on samba older than 4.8 #55185
Comments
Seems to print the version. |
we will probably want to add this check to salt/modules/pdbedit.py in |
I’m a bit busy atm, I was hoping to take a stab at it after my current open PR gets in though.
But I’d you do, let me know and I will give it a test spin.
~ sjorge
… On 4 Nov 2019, at 20:15, Megan Wilhite ***@***.***> wrote:
we will probably want to add this check to salt/modules/pdbedit.py in __virtual__. Did you want to take a stab at it or i can?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue. |
Nope, still an issue... might have some time to work on this later this month |
Thank you for updating this issue. It is no longer marked as stale. |
Very quick hack I made, I ran out of time to get this turned into a PR with tests for now. --- /opt/local/lib/python2.7/site-packages/salt/modules/pdbedit.py 2019-10-26 11:38:15.000000000 +0000
+++ pdbedit.py 2020-01-12 12:37:09.458602337 +0000
@@ -11,6 +11,7 @@
from __future__ import absolute_import, print_function, unicode_literals
# Import Python libs
+import re
import logging
import hashlib
import binascii
@@ -39,14 +40,21 @@
'''
Provides pdbedit if available
'''
- if salt.utils.path.which('pdbedit'):
- return __virtualname__
- return (
- False,
- '{0} module can only be loaded when pdbedit is available'.format(
- __virtualname__
- )
- )
+ # NOTE: check for pdbedit command
+ if not salt.utils.path.which('pdbedit'):
+ return (False, 'pdbedit command is not available')
+
+ # NOTE: check version is >= 4.8.x
+ ver = __salt__['cmd.run']('pdbedit -V')
+ ver_regex = re.compile(r'^Version\s(\d+)\.(\d+)\.(\d+)$')
+ ver_match = ver_regex.match(ver)
+ if not ver_match:
+ return (False, 'pdbedit -V returned an unknown version format')
+
+ if not (int(ver_match.group(1)) >= 4 and int(ver_match.group(2)) >= 8):
+ return (False, 'pdbedit is to old, 4.8.0 or newer is required')
+
+ return __virtualname__
def generate_nt_hash(password): |
#55185 pdbedit module should check for version 4.8.x or newer
Since I updated from Salt 2019.2 to 3000 the samba.users state I helped improve, doesn't work anymore. (https://github.com/saltstack-formulas/samba-formula/blob/master/samba/users)
It worked before.
Issue #56553 looks very similar, but I get a different error message. |
4.5 is Edit: Was it working on 4.5.x for you before? If so, we could probably lower the version requirement. I wrote pdbedit against 4.8 and I had reports of it being broken on 4.3.x and 4.4.x. |
I can probably look at fixing the regex and updating the tests to ignore the -Debian tomorrow or saturday. |
Created a PR to ignore |
I will test that on my master, and update this post later with my findings. Later: I changed the following file on a salt-minion 3000.2:
So first test looks very promising. Do you have a suggestion how I get my environment back running? Easiest would be a salt state
Yes! I'm using Debian 9 with salt-minion 2018/2018 with Update:
|
Debian seems to prepend `-Debian` behind the version, we should test those too. Also lower the requirement to 4.5.0 as apparently that version is new enough according to #55185 (comment)
closing as fixed will be released in Sodium |
Description of Issue
Someone contacted me via email that pdbedit module/state wasn't working.
The person is using samba 4.3.11 and the required fields in the pdbedit output are missing.
I was using samba 4.8.x when writing this module, there should probably be a version check that doesn't load the module when the version is older.
Setup
N/a
Steps to Reproduce Issue
Try and use pdbedit module or state on samba older than 4.8.x
Versions Report
(from e-mail)
The text was updated successfully, but these errors were encountered: