- The output of ssh-keyscan scan contain comments that start with '#'. When
these are present, they are incorrectly assumed to be valid keys. Ignore these
lines.
Tests:
- Output of ssh-keyscan with latest OpenSSH in Debian testing contains comments.
Trying to verify the identity of the remove host without the patch fails when
adding remote backup repository. When patch is applied, it works (except RSA
key).
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Fixes: #2364
Tests:
- Set language to English. Go to backups -> create. List of apps is sorted
alphabetically and case is ignored. Take a backup.
- Click on restore for the new backup. The list of apps is again sorted
alphabetically and case is ignored.
- Click on schedules. List of apps is sorted and alphabetically and case is
ignored.
- Repeat tests with Spanish locale.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
Fixes: #2115.
Tests:
- Visit the backups upload page. Notice that the new help text is as expected.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
Take app_id in a URL fragment and fill that as the default selected app in
create backup form. This URL can be used in apps to create a backup link.
Tests:
- Visit /plinth/sys/backups/create/bepasty/. Only bepasty app will be selected.
- Visit /plinth/sys/backups/create/foo/. No apps are selected.
- Visit /plinth/sys/backups/create/. All apps are selected.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.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>
- ugettext functions will be removed in Django 4.0. Each use emits a warning
when running with Django 3.2. Since we have warnings enabled in developer mode,
we see quite a few messages because of this.
- ugettext is already a simple alias of gettext. So, no regressions are
expected.
Tests:
- Accessing an affected app in UI with Django 3.2 and Django 2.2 works fine.
- Using Django 3.2 there are no warnings related to removal of ugettext
functions.
- Ran regular unit tests.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- Make the code work outside backups module.
- Move code to main.js so that any app can use this functionality.
- Make the code work for multiple such form fields in the same page.
- Use only pure JS, don't use jQuery.
- Add event handlers only after DOM content is loaded to avoid race conditions.
Tests performed:
- Checking the select-all button checks all options.
- De-checking the select-all button de-checks all options.
- De-checking one option when everything is checked, de-checks the select-all
button.
- Checking the last option when everything else is checked, checks the
select-all button.
- When loading a schedule page with all options checked, select-all button is
checked.
- When loading a schedule page with some option unchecked, select-all button is
unchecked.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Helps: #1938.
backups/forms.py:
- ChoiceField labeled to allow translation.
- Translation applied to hard coded literals.
config/forms.py:
Lazy translation applied to literals that were translated but still
displayed in english to non-english users.
diagnostics_results.html:
Apply translation to results. Use gettext_noop to mark for translation.
dynamicdns/forms.py:
Apply translation to choice literals.
i2p/views.py:
Lazy translation applied to literals that were translated but still
displayed in english to non-english users.
names.html:
Apply translation to table headers.
performance/__init__.py:
Apply translation to description literals.
radicale/forms.py:
ChoiceField labeled to allow translation.
users/forms.py:
CharField labeled to allow translation.
QA:
- Literals visually verified.
- No errors in py.test-3.
- Yapf applied (only) to changed files.
- No remarks by flake8 to changed file.
Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com>
[sunil: Separate out the translations]
[sunil: Fix i18n for diagnostics]
[sunil: dynamicdns: Also do i18n for string GnuDIP]
[sunil: searx: Revert an incorrect removal of import]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Although useradd recommends starting with either a lowercase letter or an
underscore, there is nothing that consistently adheres to this recommendation
across systems. Because some systems do not follow this recommendation and this
recommendation is not a hard requirement, we should not prevent connections at
the validation stage.
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
Rename get_disks() to get_mounts() and use it in for backups and samba shares.
Create a new get_disks() similar to get_mounts() but use df information only for
showing free space. This inverts the importance of 'df' and UDisks. Use UDisks
as primary source of information for showing list of disks and then use df to
fill in the free space information.
- Retrieve all the mount points of a device and return them as part of
get_disks() in an extra 'mount_points' property.
- For storage listing, this fixes showing up of /.snapshots as separate disk and
showing of vboxsf, network mounts etc. Only shows mounts that are related to
block devices.
- Update various uses of get_disks() within storage module to use
'mounts_points' instead of 'mount_point' to be accurate in cases where there are
multiple mounts for a given device. Use get_mounts() where appropriate instead.
- Display all the mount points against a devices in multiple lines.
- Also show devices that are not currently mounted.
Tests performed:
- Filling up a disk shows a disk space warning properly. Warning contains the
free disk space correctly.
- Calling get_root_device(get_disks()) return the correct root device.
- In Deluge, the download directory contains a list of all samba current shares.
If a disk with samba share is unmouted, it does not show up in the list.
- In the Samba app page, all disks are shown properly. Root disk is shown as
'disk'. All other mount points such as .snapshots and /vagrant also show up.
- In the Samba app page, unavailable shares list shows up when a disk with a
share is unmounted.
- Upload a backup, warning on the form shows available disk space properly.
- When adding a backup location. The list includes all mount points. Duplicated
mount points are not shown. Root disk is not shown in the list. When all the
disks are used up for backup location, a warning that no additional disks are
available is shown.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- Remove the need to pass all the individual information elements to the AppView
separately. This eliminates many issues with elements that were mistakenly not
sent to AppView. Also reduces a lot of code duplication.
- Create App classes for power and sso for consistency.
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit takes the stderr of `ssh-keyscan` (in case of a returncode thats not
zero) and stores it as as string in the form object. The view then displays the
information as preformatted text in a warning class.
Signed-off-by: Birger Schacht <birger@rantanplan.org>
[sunil: Cosmetic: variable name change for consistent naming]
[sunil: <pre> can't be inside <p>, keep it out]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
- Without this users can create multiple repositories for the same disk
location.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Make consumers depend on the repository classes instead of lower level store
API.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
get_repositories method will return repositories instead of dictionaries for
view content. This will make it usable in more situations.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Same module is being used to store/retrieve local disk repositories also.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This introduces flake8 and fixes a bunch of flake8 errors.
flake8 is run with: ./venv/bin/flake8 plinth
if you're using a python3 venv.
We can eventually further integrate this with gitlab ci.
https://salsa.debian.org/freedombox-team/plinth/issues/58
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
- Remove Python code to handle the extra item in the submitted form
- The select-all checkbox is never submitted in the form since it is missing the
"name" attribute
- Replace selector ':checkbox' with the faster selector '[type=checkbox]'
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This is less tiresome for users and also improves the speed of functional tests.
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
Ensure that the fingerprint accepted is the one verified by user. If they
fingerprints and public keys are retrieved separately, there is chance that what
was verified by the user is not what is added to the known hosts file.
- Avoid creating a temporary file when fetching keys
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
- Assume that their SSH public keys are not unverified.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
- Add docstrings.
- Add blank lines for extra readability.
- Use <span> instead of <i> tag for icon in template.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
- From SSH manual, a path may contain : if it is presented as absolute path.
Update regular expression for splitting accordingly.
- Allow Null paths similar to SSH.
- Perform a full regular expression match when splitting path.
- Simplify regular expression.
- Update tests.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
- Create empty directory if not exists
- Check if the directory is empty
- if not empty, check if it's an existing backup repository
- else throw an error
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
- fixes issues as supposed by jvalleroy
- new repositories always get a UUID so they can immediately be fully
used (mounted, queried etc) also before saving them
- remove test connection page -- errors are shown on form submission
- improved error handling when creating remote repositories
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
- integrate remote repositories into backups index page
- remove, mount and unmount repositories via UI
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>