Skip to content
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

Ignore XFS mountpoints in CageFS skeleton #84

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from leapp.libraries.stdlib import api, run
from leapp.libraries.stdlib import api, run, CalledProcessError
from leapp.models import StorageInfo, XFSPresence


Expand All @@ -21,11 +21,18 @@ def scan_xfs_mount(data):


def is_xfs_without_ftype(mp):
for l in run(['/usr/sbin/xfs_info', '{}'.format(mp)], split=True)['stdout']:
if 'ftype=0' in l:
return True

return False
try:
for l in run(['/usr/sbin/xfs_info', '{}'.format(mp)], split=True)['stdout']:
if 'ftype=0' in l:
return True

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just return any('ftype=0' in line for line in run(['/usr/sbin/xfs_info', '{}'.format(mp)], split=True)['stdout'])

return False
# xfs_info can sometimes throw errors like the following if fed a CageFS mountpoint.
# xfs_info: /usr/share/cagefs-skeleton/var/www/cgi-bin\040(deleted) is not a mounted XFS filesystem

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe better write "like the following one if it's given a CageFS mountpoint."

except CalledProcessError as err:
if "cagefs" in mp:
api.current_logger().info("CageFS XFS mountpoint {} ignored in scanner".format(mp))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if there is an invalid cagefs mount (let's say specified in cagefs.mp file) without cagefs in path? We are going to stop the elevation process and expecting customer to handle such a case by himself?

return False
raise err


def scan_xfs():
Expand Down
Loading