storage: Show disks if FreedomBox is running in an unprivileged container

- Get disks info from df command and add info from udisks, if available.
  Before, it was other way round.
- Add a functional test that asserts root disk is available
- Remove unused key file_system_type from disks info

Closes #1765

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Veiko Aasa authored and James Valleroy committed 2020-02-02 09:40:12 -05:00
1 parent a0415bc110
commit 0f16a0fbee
7 files changed
+54 -11

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
#
# This file is part of FreedomBox.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
@system @storage @essential
Feature: Storage
Show information about the disks.
Background:
Given I'm a logged in user
Scenario: List disks
Given I'm on the storage page
Then the root disk should be shown
@@ -98,3 +98,8 @@ def help_go_to_status_logs(session_browser):
@then('status logs should be shown')
def help_status_logs_are_shown(session_browser):
assert interface.are_status_logs_shown(session_browser)
@given(parsers.parse("I'm on the {name:w} page"))
def go_to_module(session_browser, name):
interface.nav_to_module(session_browser, name)
@@ -356,3 +356,8 @@ def main_page_is_shown(session_browser):
@given(parsers.parse('the network device is in the {zone:w} firewall zone'))
def networks_set_firewall_zone(session_browser, zone):
system.networks_set_firewall_zone(session_browser, zone)
@then('the root disk should be shown')
def storage_root_disk_is_shown(session_browser):
assert system.storage_is_root_disk_shown(session_browser)
+2 -2
View File
@@ -28,8 +28,8 @@ from .service import wait_for_page_update
sys_modules = [
'avahi', 'backups', 'bind', 'cockpit', 'config', 'datetime', 'diagnostics',
'dynamicdns', 'firewall', 'letsencrypt', 'monkeysphere', 'names',
'networks', 'pagekite', 'power', 'security', 'snapshot', 'ssh', 'upgrades',
'users'
'networks', 'pagekite', 'power', 'security', 'snapshot', 'ssh', 'storage',
'upgrades','users'
]
default_url = config['DEFAULT']['url']
+5
View File
@@ -427,3 +427,8 @@ def networks_set_firewall_zone(browser, zone):
browser.find_link_by_href(edit_url).first.click()
browser.select('zone', zone)
browser.find_by_tag("form").first.find_by_tag('input')[-1].click()
def storage_is_root_disk_shown(browser):
table_cells = browser.find_by_tag('td')
return any(cell.text == '/' for cell in table_cells)