-
Notifications
You must be signed in to change notification settings - Fork 186
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
Enhance httpd spec include #3977
Enhance httpd spec include #3977
Conversation
insights/specs/default.py
Outdated
# "/etc/httpd/conf.d/*/*.conf", | ||
# "/etc/httpd/conf.modules.d/*.conf" | ||
# ] | ||
# ) | ||
httpd_conf_scl_httpd24 = glob_file( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better update the httpd_conf_scl_httpd24
and httpd_conf_scl_jbcs_httpd24
as well.
insights/specs/datasources/httpd.py
Outdated
with open(conf) as cfp: | ||
_includes = None | ||
for line in cfp.readlines()[::-1]: | ||
if ("Include" in line or "IncludeOptional" in line) and (line.strip().startswith("Include") or line.strip().startswith("IncludeOptional")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If startswith
is must-be-checked, better only keep it in the condition, since the in
is overlapped by startswith
line = line.strip()
if line.startswith(("Include, "IncludeOptional")): # --> it seems `line.startswith("Include")`: is enough, right?
insights/specs/datasources/httpd.py
Outdated
for line in cfp.readlines()[::-1]: | ||
if "ServerRoot" in line and line.strip().startswith("ServerRoot"): | ||
server_root = line.strip().split()[-1].strip().strip('"\'') | ||
elif ("Include" in line or "IncludeOptional" in line) and (line.strip().startswith("Include") or line.strip().startswith("IncludeOptional")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same comment as above.
insights/specs/datasources/httpd.py
Outdated
# Add it only when it exists | ||
all_paths.add(main_httpd_conf) | ||
for line in cfp.readlines()[::-1]: | ||
if "ServerRoot" in line and line.strip().startswith("ServerRoot"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same comment as above
line = line.strip()
if line.startswith("ServerRoot"):
server_root = line.strip().split()[-1].strip().strip('"\'') | ||
elif ("Include" in line or "IncludeOptional" in line) and (line.strip().startswith("Include") or line.strip().startswith("IncludeOptional")): | ||
includes = line.strip().split()[-1].strip('"\'') | ||
all_paths.update(_get_all_include_conf(server_root, includes)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind adding a comment about, e.g.: For multiple "Include" directives, all of them will be included
insights/specs/datasources/httpd.py
Outdated
_paths.add(conf) | ||
with open(conf) as cfp: | ||
_includes = None | ||
for line in cfp.readlines()[::-1]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If all multiple "Include" directives will be included, the [::-1]
operation is not required, please remove it.
insights/specs/datasources/httpd.py
Outdated
_paths.add(conf) | ||
with open(conf) as cfp: | ||
_includes = None | ||
for line in cfp.readlines()[::-1]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If all multiple "Include" directives will be included, the [::-1]
operation is not required, please remove it.
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]>
Signed-off-by: jiazhang <[email protected]> (cherry picked from commit 3d3eefe)
All Pull Requests:
Check all that apply:
Complete Description of Additions/Changes:
This PR is used to enhance httpd_conf spec so that it can handle
Include
situation.