1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Added support for openSUSE MicroOS (#5998)

* fix(zypper): Added condition to check for transactional-update binary to support microos

closes #5615

* style(changelog): Made zypper-change uppercase

Co-authored-by: Felix Fontein <felix@fontein.de>

* fix(zypper): Removed check for /var/lib/misc/transactional-update.state

* feat(zypper): Aligned transactional-update checks with zypper's

* refactor(zypper): Removed dependency to psutil and made use of parsing /proc/mount

* refactor(zypper): Removed need for regex, plus small refactoring

---------

Co-authored-by: André Dörscheln <ad@itesign.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
andre161292 2023-02-25 10:58:04 +01:00 committed by GitHub
parent de1f0ff419
commit 2c762c4753
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "zypper - make package managing work on readonly filesystem of openSUSE MicroOS (https://github.com/ansible-collections/community.general/pull/5615)."

View file

@ -519,8 +519,21 @@ def repo_refresh(m):
return retvals
def get_fs_type_and_readonly_state(mount_point):
with open('/proc/mounts', 'r') as file:
for line in file.readlines():
fields = line.split()
path = fields[1]
if path == mount_point:
fs = fields[2]
opts = fields[3]
return fs, 'ro' in opts.split(',')
return None
def transactional_updates():
return os.path.exists('/var/lib/misc/transactional-update.state')
return os.path.exists('/usr/sbin/transactional-update') and get_fs_type_and_readonly_state('/') == ('btrfs', True)
# ===========================================
# Main control flow