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
do_file_sub error with "global flags not at the start of the expression at position 1" for juju plugin on ubuntu #3301
Comments
I believe this should be resolved by #3263 which is in 4.5.5. |
Negative, the packages I am testing does take that patch too on top of 4.5.4 |
This reproduces on current sos main too,
|
this seems purely a juju plugin issue, and should be fixed by this patch,
I tested it, and no longer see the issue
Thoughts @arif-ali @dnegreira ? |
This is a python3.11 issue From the python 3.11 docs
So, in essence a lot of the regex in the sos code would need to change to conform to this new way, maybe something similar to the diff below, but all the plugins that have this regex format diff --git a/sos/report/plugins/openstack_cinder.py b/sos/report/plugins/openstack_cinder.py
index 23483a8d..38eec6dc 100644
--- a/sos/report/plugins/openstack_cinder.py
+++ b/sos/report/plugins/openstack_cinder.py
@@ -94,13 +94,13 @@ class OpenStackCinder(Plugin):
connection_keys = ["connection"]
self.apply_regex_sub(
- r"((?m)^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
- r"\1*********"
+ r"(?m)(^\s*(%s)\s*=\s*)(.*)" % "|".join(protect_keys),
+ r"\1\2*********"
)
self.apply_regex_sub(
- r"((?m)^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
+ r"(?m)(^\s*(%s)\s*=\s*(.*)://(\w*):)(.*)(@(.*))" %
"|".join(connection_keys),
- r"\1*********\6"
+ r"\1\2*********\6"
) At first glance and greping for |
Ok, so looking at where/how this is implemented in our plugins, they're all using the same While this touches a decent number of plugins, the change is actually fairly simple. But, in changing this should we still keep this form of passing flags, or should we instead allow plugins to define their own flags in these calls (or perhaps even make |
Add a common regex for re.MULTILINE so that doesn't need to be defined and remove the definitions where `(?m)` is being defined Closes: sosreport#3301 Signed-off-by: Arif Ali <arif.ali@canonical.com>
We liked the idea of having a default of |
I tested the PR #3303 and it works well - testing shows the issue reproducing on the 4.5.4 lunar packages as well as upstream main but fixed in Arif's patch
|
Add a common regex for re.MULTILINE so that doesn't need to be defined and remove the definitions where `(?m)` is being defined Closes: #3301 Signed-off-by: Arif Ali <arif.ali@canonical.com>
I ran into this while testing 4.5.4 proposed lunar packages for Ubuntu (with the fix for #3261 built additionally into 4.5.4) and I wonder if RH plugins might hit this too in openshift.py like it was the case in #3261 , since this seems related to the way regexes work in python 3.11
sos.logs shows when sos report --all-logs was run in an openstack environment running lunar lobster,
2023-07-07 07:54:20,426 ERROR: caught exception in plugin method "juju.postproc()"
2023-07-07 07:54:20,426 ERROR: writing traceback to sos_logs/juju-plugin-errors.txt
https://opendev.org/openstack/python-cinderclient/commit/20506ef3a8b5fb1b7a9b0a2c31dbe5f60eea2130 might be relevant which mentions "In Python3.11, global flags must be placed right at the start of a regular expression."
The text was updated successfully, but these errors were encountered: