mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
*: Always pass check= argument to subprocess.run()
- Avoid flake8 warnings. - Makes the call more explicitly readable in case an exception is expected but check=True is not passed by mistake. Tests: - Many tests are skipped since the changes are considered trivial. check=False is already the default for subprocess.run() method. - actions/package: Install an app when it is not installed. - actions/upgrade: Run manual upgrades. - actions/users: Change a user password. Login. Create/remove a user. - actions/zoph: Restore a database. - container: On a fresh repository, run ./container up,ssh,stop,destroy for a testing container. - plinth/action_utils.py: Enable/disable an app that has a running service. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
ebd357476d
commit
9bd1f80d5c
17 files changed
+62
-55
No files matched your search
@@ -128,10 +128,10 @@ def service_action(service_name, action):
|
||||
"""Perform the given action on the service_name."""
|
||||
if is_systemd_running():
|
||||
subprocess.run(['systemctl', action, service_name],
|
||||
stdout=subprocess.DEVNULL)
|
||||
stdout=subprocess.DEVNULL, check=False)
|
||||
else:
|
||||
subprocess.run(['service', service_name, action],
|
||||
stdout=subprocess.DEVNULL)
|
||||
stdout=subprocess.DEVNULL, check=False)
|
||||
|
||||
|
||||
def webserver_is_enabled(name, kind='config'):
|
||||
@@ -371,7 +371,7 @@ Owners: {package}
|
||||
env['DEBCONF_DB_OVERRIDE'] = 'File{' + override_file.name + \
|
||||
' readonly:true}'
|
||||
env['DEBIAN_FRONTEND'] = 'noninteractive'
|
||||
subprocess.run(['dpkg-reconfigure', package], env=env)
|
||||
subprocess.run(['dpkg-reconfigure', package], env=env, check=False)
|
||||
|
||||
try:
|
||||
os.remove(override_file.name)
|
||||
@@ -419,7 +419,7 @@ def run_apt_command(arguments):
|
||||
env['DEBIAN_FRONTEND'] = 'noninteractive'
|
||||
process = subprocess.run(command, stdin=subprocess.DEVNULL,
|
||||
stdout=subprocess.DEVNULL, close_fds=False,
|
||||
env=env)
|
||||
env=env, check=False)
|
||||
return process.returncode
|
||||
|
||||
|
||||
@@ -458,7 +458,8 @@ def apt_hold_freedombox():
|
||||
def apt_unhold_freedombox():
|
||||
"""Remove any hold on freedombox package, and clear flag."""
|
||||
subprocess.run(['apt-mark', 'unhold', 'freedombox'],
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
|
||||
check=False)
|
||||
if apt_hold_flag.exists():
|
||||
apt_hold_flag.unlink()
|
||||
|
||||
|
||||
Reference in new issue
Block a user