- This was required in Python 2 but useless in Python 3.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
`apt-mark hold PACKAGES` accepts a list of packages. But if one of the
package is missing from the apt repository, then it will fail to hold
any of the listed packages. So it is necessary to try to hold each
package by itself.
Test:
- Run dist-upgrade from bullseye to bookworm. mumble-server package is
currently missing from bookworm, but it should not cause an error in
dist-upgrade.
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
- 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>
Some actions that use this function are expected to output
JSON. Any output from apt-mark can interfere with this.
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Guard against removing a hold while the package manager is busy.
Test:
1. Place hold on freedombox package.
2. Wait 3 minutes in development mode.
- Package is held.
3. Touch /var/lib/freedombox/package-held.
4. Wait 3 minutes in development mode.
- Package is not held.
- Flag is removed.
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This is to recover from a situation where the package is held, and
then plinth process is interrupted so it cannot release the hold.
We check for and recover from this situation when installing new apps,
and when running dist upgrade. This provides another way to recover
from the problem, by running manual update.
Tests:
- (normal) No hold on freedombox package, and flag is not set. Run
manual update. Afterwards, there is no hold, and flag is not set.
- (admin preference) Place hold on freedombox package, but flag is not
set. Run manual update. Afterwards, there is still a hold, but flag is
not set.
- (recovery) Place hold on freedombox package, but flag is
set. Run manual update. Afterwards, there is no hold, and flag is not
set.
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
In case the plinth process is interrupted, the "finally" block that is
meant to unhold the package may not be executed, and the package will
stay held. The flag is used to indicate this situation, so it can be
resolved the next time apt_hold_freedombox is used.
Tests:
- (normal) No hold on freedombox package, and flag is not set. Install
any app. Afterwards, there is no hold, and flag is not set.
- (admin preference) Place hold on freedombox package, but flag is not
set. Install any app. Afterwards, there is still a hold, but flag is
not set.
- (recovery) Place hold on freedombox package, but flag is
set. Install any app. Afterwards, there is no hold, and flag is not
set.
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Performs this hold separately from the others, and ignore errors only
for tt-rss.
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Run `apt-get --fix-broken install` before installing package or manual
update. This will attempt to correct broken dependencies.
Tests:
- Install a package without its dependencies using `dpkg -i`.
- Both app install and manual update successfully recover from this
situation.
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Services that have socket activation enabled (e.g avahi) could automatically
start again after they are stopped manually. This change disables service
before stopping it, preventing it from auto-starting again.
Closes#1772
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- Curl: if an IPv6 zone index is specified, use --interface parameter.
This fixes two issues:
- Curl in Debian Buster doesn't support an IPv6 zone index in URL
- Curl in Debian Bullseye doesn't redirect properly if a zone index is in URL.
- Disable IPv6 diagnostics on daemons that don't listen on an IPv6 address:
plinth, deluge, transmission
Closes#1519
Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
A caught Exception should always be considered a failed test.
Signed-off-by: Matthias Dellweg <2500@gmx.de>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Closes: #1303.
Test:
Reproduce the problem with debconf-set-selections. Install tt-rss. run
debconf-set
apt install tt-rss
echo 'tt-rss tt-rss/database-type string pgsql' | debconf-set-selections
apt purge tt-rss
echo 'tt-rss tt-rss/database-type string pgsql' | debconf-set-selections
error: Cannot find a question for tt-rss/database-type
Then run try to install ttrss without patch and observe that it fails. Apply
the patch and see that ttrss is installed properly. Observe that database
configured in /etc/ttrss/database.php is 'pgsql'.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- Add settings in Service View
- Fixes for maximum file setting
- Don't allow negative values for max. file size in UI
- Minor text changes to django messages
- Minor correction to maximum file size calculation
- Rename apache conf file to coquelicot-freedombox.conf
- Remove all hacks to adjust file size.
- Fix permissions issues for settings file
- Show status block in UI
- try-restart on settings change instead of restart
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Installs and configures MediaWiki. SSO integration is not included yet.
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- Transmission version wasn't updated, so the new configuration didn't take
effect.
- The new configuration disabled Transmission's own auth and an apache reload is
required for SSO auth to be enabled for Transmission. This was not happening
because webserver_enable command finds that webserver is already enabled for
Transmission. It cannot detect upgrades. Hence disabled that check for
reloads. We're still avoiding restarts if there's no config change, just like
before.
Fixes#1139
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- Closes#928
- Adds shell and python APIs adding/removing LDAP groups
Signed-off-by: Rahul De <rahul080327@gmail.com>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Run sudo-required action via actions.superuser_run
Actions related to services those require `sudo` permissions need to
be executed via actions.superuser_run.
NOTE:
If plinth service is started via `sudo ./run --debug` (in dev mode)
all actions will be executed silently. But plinth in user machines
won't be executed with sudo permissions.
wget does not seem to support interface scoping for IPv6 addresses. For
example, http_proxy=http://[fe80::babe:ff:ffff:babe%eth0]:8118/ . Curl
supports this.
This fixes most of the failures for IPv6 related addresses. Hide the
last failure as there does not seem to be a proper fix from OS level:
when using link local addresses, if a hostname is resolved to IPv6 link
local address, it is not scoped to that interface. It can't properly be
used by any tool then.
In case of start/stop/restart/reload and to check whether service is
running, fallback to sysvinit scripts when systemd is not running. This
happens inside a chroot environment when setup of essential components
is happening.
Some of the important modules such as php5, cgi and authnz_ldap are
enabled by default in freedombox-setup. However, when installing
ikiwiki we still restart the apache2 web server. This patch fixes that
by restart or reloading only when the corresponding module/config/site
is not already in the state required.