def test_packages_setup(): """Test setting up packages component.""" class TestApp(App): """Test app""" app_id = 'test-app' component = Packages('test-component', ['python3', 'bash']) app = TestApp() app.add(component) setup_helper.reset_mock() app.setup(old_version=3) setup_helper.install.assert_has_calls( [call(['python3', 'bash'], skip_recommends=False)]) component = Packages('test-component', ['bash', 'perl'], skip_recommends=True) app = TestApp() app.add(component) setup_helper.reset_mock() app.setup(old_version=3) setup_helper.install.assert_has_calls( [call(['bash', 'perl'], skip_recommends=True)]) component = Packages('test-component', [Package('python3') | Package('unknown-package')]) app = TestApp() app.add(component) setup_helper.reset_mock() app.setup(old_version=3) setup_helper.install.assert_has_calls( [call(['python3'], skip_recommends=False)])
def test_packages_has_unavailable_packages(path_class, cache): """Test checking for unavailable packages.""" path = Mock() path_class.return_value = path path.iterdir.return_value = [Mock()] component = Packages('test-component', ['package1', 'package2']) assert component.has_unavailable_packages() is None path.iterdir.return_value = [Mock(), Mock()] cache.return_value = ['package1', 'package2'] assert not component.has_unavailable_packages() cache.return_value = ['package1'] assert component.has_unavailable_packages()
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, is_essential=True, name=_('Storage Snapshots'), icon='fa-film', description=_description, manual_page='Snapshots') self.add(info) menu_item = menu.Menu('menu-snapshot', info.name, None, info.icon, 'snapshot:index', parent_url_name='system') self.add(menu_item) packages = Packages('packages-snapshot', ['snapper']) self.add(packages) backup_restore = SnapshotBackupRestore('backup-restore-snapshot', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info( app_id=self.app_id, version=self._version, depends=['names'], name=_('PageKite'), icon='fa-flag', short_description=_('Public Visibility'), description=_description, manual_page='PageKite', donation_url='https://pagekite.net/support/faq/#donate') self.add(info) menu_item = menu.Menu('menu-pagekite', info.name, info.short_description, info.icon, 'pagekite:index', parent_url_name='system') self.add(menu_item) packages = Packages('packages-pagekite', ['pagekite']) self.add(packages) domain_type = DomainType('domain-type-pagekite', _('PageKite Domain'), 'pagekite:index', can_have_certificate=True) self.add(domain_type) daemon = Daemon('daemon-pagekite', self.DAEMON) self.add(daemon) backup_restore = BackupRestore('backup-restore-pagekite', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, is_essential=True, name=_('Software Update'), icon='fa-refresh', description=_description, manual_page='Upgrades') self.add(info) menu_item = menu.Menu('menu-upgrades', info.name, None, info.icon, 'upgrades:index', parent_url_name='system') self.add(menu_item) packages = Packages('packages-upgrades', ['unattended-upgrades', 'needrestart']) self.add(packages) daemon = RelatedDaemon('related-daemon-upgrades', 'freedombox-dist-upgrade') self.add(daemon) backup_restore = BackupRestore('backup-restore-upgrades', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, is_essential=True, name=_('Security'), icon='fa-lock', manual_page='Security') self.add(info) menu_item = menu.Menu('menu-security', info.name, None, info.icon, 'security:index', parent_url_name='system') self.add(menu_item) packages = Packages('packages-security', ['fail2ban', 'debsecan']) self.add(packages) daemon = RelatedDaemon('related-daemon-fail2ban', 'fail2ban') self.add(daemon) backup_restore = BackupRestore('backup-restore-security', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, is_essential=True, depends=['names'], name=_('Service Discovery'), icon='fa-compass', description=_description, manual_page='ServiceDiscovery') self.add(info) menu_item = menu.Menu('menu-avahi', info.name, None, info.icon, 'avahi:index', parent_url_name='system') self.add(menu_item) packages = Packages('packages-avahi', ['avahi-daemon', 'avahi-utils']) self.add(packages) domain_type = DomainType('domain-type-local', _('Local Network Domain'), 'config:index', can_have_certificate=False) self.add(domain_type) firewall = Firewall('firewall-avahi', info.name, ports=['mdns'], is_external=False) self.add(firewall) daemon = Daemon('daemon-avahi', 'avahi-daemon') self.add(daemon) backup_restore = BackupRestore('backup-restore-avahi', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info( app_id=self.app_id, version=self._version, is_essential=True, depends=['storage'], name=_('Backups'), icon='fa-files-o', description=_description, manual_page='Backups', donation_url='https://www.borgbackup.org/support/fund.html') self.add(info) menu_item = menu.Menu('menu-backups', info.name, None, info.icon, 'backups:index', parent_url_name='system') self.add(menu_item) packages = Packages('packages-backups', ['borgbackup', 'sshfs']) self.add(packages)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, is_essential=True, name=_('Date & Time'), icon='fa-clock-o', description=_description, manual_page='DateTime') self.add(info) menu_item = menu.Menu('menu-datetime', info.name, None, info.icon, 'datetime:index', parent_url_name='system') self.add(menu_item) packages = Packages('packages-datetime', ['systemd-timesyncd']) self.add(packages) if self._is_time_managed(): daemon = Daemon('daemon-datetime', 'systemd-timesyncd') self.add(daemon) backup_restore = BackupRestore('backup-restore-datetime', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, is_essential=True, depends=['apache', 'firewall', 'names'], name=_('General Configuration'), icon='fa-cog', description=_description, manual_page='Configure') self.add(info) menu_item = menu.Menu('menu-config', _('Configure'), None, info.icon, 'config:index', parent_url_name='system') self.add(menu_item) packages = Packages('packages-config', ['zram-tools']) self.add(packages) daemon1 = RelatedDaemon('related-daemon-config1', 'systemd-journald') self.add(daemon1) daemon2 = RelatedDaemon('related-daemon-config2', 'rsyslog') self.add(daemon2) domain_type = DomainType('domain-type-static', _('Domain Name'), 'config:index', can_have_certificate=True) self.add(domain_type)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info( app_id=self.app_id, version=self._version, name=_('WireGuard'), icon_filename='wireguard', short_description=_('Virtual Private Network'), description=_description, manual_page='WireGuard', clients=manifest.clients, donation_url='https://www.wireguard.com/donations/') self.add(info) menu_item = menu.Menu('menu-wireguard', info.name, info.short_description, info.icon_filename, 'wireguard:index', parent_url_name='apps') self.add(menu_item) shortcut = frontpage.Shortcut( 'shortcut-wireguard', info.name, short_description=info.short_description, icon=info.icon_filename, description=info.description, configure_url=reverse_lazy('wireguard:index'), login_required=True, clients=info.clients) self.add(shortcut) packages = Packages('packages-wireguard', ['wireguard']) self.add(packages) firewall = Firewall('firewall-wireguard', info.name, ports=['wireguard-freedombox'], is_external=True) self.add(firewall)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, is_essential=True, depends=['names'], name=_('Let\'s Encrypt'), icon='fa-lock', short_description=_('Certificates'), description=_description, manual_page='LetsEncrypt', donation_url='https://letsencrypt.org/donate/') self.add(info) menu_item = menu.Menu('menu-letsencrypt', info.name, info.short_description, info.icon, 'letsencrypt:index', parent_url_name='system') self.add(menu_item) packages = Packages('packages-letsencrypt', ['certbot']) self.add(packages) backup_restore = BackupRestore('backup-restore-letsencrypt', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, is_essential=True, name=_('Secure Shell (SSH) Server'), icon='fa-terminal', description=_description) self.add(info) menu_item = menu.Menu('menu-ssh', info.name, None, info.icon, 'ssh:index', parent_url_name='system') self.add(menu_item) packages = Packages('packages-ssh', ['openssh-server']) self.add(packages) firewall = Firewall('firewall-ssh', info.name, ports=['ssh'], is_external=True) self.add(firewall) daemon = Daemon('daemon-ssh', 'ssh') self.add(daemon) backup_restore = BackupRestore('backup-restore-ssh', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() self.groups = {'vpn': _('Connect to VPN services')} info = app_module.Info(app_id=self.app_id, version=self._version, name=_('OpenVPN'), icon_filename='openvpn', short_description=_('Virtual Private Network'), description=_description, manual_page='OpenVPN', clients=manifest.clients) self.add(info) menu_item = menu.Menu('menu-openvpn', info.name, info.short_description, info.icon_filename, 'openvpn:index', parent_url_name='apps') self.add(menu_item) download_profile = \ format_lazy(_('<a class="btn btn-primary btn-sm" href="{link}">' 'Download Profile</a>'), link=reverse_lazy('openvpn:profile')) shortcut = frontpage.Shortcut( 'shortcut-openvpn', info.name, short_description=info.short_description, icon=info.icon_filename, description=info.description + [download_profile], configure_url=reverse_lazy('openvpn:index'), login_required=True, allowed_groups=['vpn']) self.add(shortcut) packages = Packages('packages-openvpn', ['openvpn', 'easy-rsa']) self.add(packages) firewall = Firewall('firewall-openvpn', info.name, ports=['openvpn'], is_external=True) self.add(firewall) daemon = Daemon('daemon-openvpn', 'openvpn-server@freedombox', listen_ports=[(1194, 'udp4'), (1194, 'udp6')]) self.add(daemon) users_and_groups = UsersAndGroups('users-and-groups-openvpn', groups=self.groups) self.add(users_and_groups) backup_restore = BackupRestore('backup-restore-openvpn', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() groups = { 'bit-torrent': _('Download files using BitTorrent applications') } info = app_module.Info( app_id=self.app_id, version=self._version, name=_('Transmission'), icon_filename='transmission', short_description=_('BitTorrent Web Client'), description=_description, manual_page='Transmission', clients=manifest.clients, donation_url='https://transmissionbt.com/donate/') self.add(info) menu_item = menu.Menu('menu-transmission', info.name, info.short_description, info.icon_filename, 'transmission:index', parent_url_name='apps') self.add(menu_item) shortcut = frontpage.Shortcut( 'shortcut-transmission', info.name, short_description=info.short_description, icon=info.icon_filename, url='/transmission', clients=info.clients, login_required=True, allowed_groups=list(groups)) self.add(shortcut) packages = Packages('packages-transmission', ['transmission-daemon']) self.add(packages) firewall = Firewall('firewall-transmission', info.name, ports=['http', 'https', 'transmission-client'], is_external=True) self.add(firewall) webserver = Webserver('webserver-transmission', 'transmission-plinth', urls=['https://{host}/transmission']) self.add(webserver) daemon = Daemon( 'daemon-transmission', self.DAEMON, listen_ports=[ (9091, 'tcp4'), (51413, 'tcp4'), (51413, 'tcp6'), (51413, 'udp4'), ]) self.add(daemon) users_and_groups = UsersAndGroups('users-and-groups-transmission', reserved_usernames=[SYSTEM_USER], groups=groups) self.add(users_and_groups) backup_restore = BackupRestore('backup-restore-transmission', **manifest.backup) self.add(backup_restore)
def test_packages_get_actual_packages(): """Test resolving of package expressions to actual packages.""" component = Packages('test-component', ['python3']) assert component.get_actual_packages() == ['python3'] component = Packages('test-component', [Package('unknown-package') | Package('python3')]) assert component.get_actual_packages() == ['python3'] component = Packages('test-component', [], skip_recommends=True, conflicts=['conflict1', 'conflict2'], conflicts_action=Packages.ConflictsAction.IGNORE) assert component.get_actual_packages() == []
def __init__(self): """Create components for the app.""" super().__init__() self._private_mode = True info = app_module.Info(app_id=self.app_id, version=self._version, name=_('MediaWiki'), icon_filename='mediawiki', short_description=_('Wiki'), description=_description, manual_page='MediaWiki', clients=manifest.clients) self.add(info) menu_item = menu.Menu('menu-mediawiki', info.name, info.short_description, info.icon_filename, 'mediawiki:index', parent_url_name='apps') self.add(menu_item) shortcut = Shortcut('shortcut-mediawiki', info.name, short_description=info.short_description, icon=info.icon_filename, url='/mediawiki', clients=info.clients, login_required=True) self.add(shortcut) packages = Packages('packages-mediawiki', ['mediawiki', 'imagemagick', 'php-sqlite3']) self.add(packages) firewall = Firewall('firewall-mediawiki', info.name, ports=['http', 'https'], is_external=True) self.add(firewall) webserver = Webserver('webserver-mediawiki', 'mediawiki', urls=['https://{host}/mediawiki']) self.add(webserver) webserver = Webserver('webserver-mediawiki-freedombox', 'mediawiki-freedombox') self.add(webserver) daemon = Daemon('daemon-mediawiki', 'mediawiki-jobrunner') self.add(daemon) backup_restore = BackupRestore('backup-restore-mediawiki', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, name=_('Coturn'), icon_filename='coturn', short_description=_('VoIP Helper'), description=_description, manual_page='Coturn') self.add(info) menu_item = menu.Menu('menu-coturn', info.name, info.short_description, info.icon_filename, 'coturn:index', parent_url_name='apps') self.add(menu_item) packages = Packages('packages-coturn', ['coturn']) self.add(packages) firewall = Firewall('firewall-coturn', info.name, ports=['coturn-freedombox'], is_external=True) self.add(firewall) letsencrypt = LetsEncrypt( 'letsencrypt-coturn', domains=get_domains, daemons=['coturn'], should_copy_certificates=True, private_key_path='/etc/coturn/certs/pkey.pem', certificate_path='/etc/coturn/certs/cert.pem', user_owner='turnserver', group_owner='turnserver', managing_app='coturn') self.add(letsencrypt) daemon = Daemon( 'daemon-coturn', 'coturn', listen_ports=[(3478, 'udp4'), (3478, 'udp6'), (3478, 'tcp4'), (3478, 'tcp6'), (3479, 'udp4'), (3479, 'udp6'), (3479, 'tcp4'), (3479, 'tcp6'), (5349, 'udp4'), (5349, 'udp6'), (5349, 'tcp4'), (5349, 'tcp6'), (5350, 'udp4'), (5350, 'udp6'), (5350, 'tcp4'), (5350, 'tcp6')]) self.add(daemon) users_and_groups = UsersAndGroups('users-and-groups-coturn', reserved_usernames=['turnserver']) self.add(users_and_groups) backup_restore = BackupRestore('backup-restore-coturn', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info( app_id=self.app_id, version=self._version, name=_('Minetest'), icon_filename='minetest', short_description=_('Block Sandbox'), description=_description, manual_page='Minetest', clients=manifest.clients, donation_url='https://www.minetest.net/get-involved/#donate') self.add(info) menu_item = menu.Menu('menu-minetest', info.name, info.short_description, info.icon_filename, 'minetest:index', parent_url_name='apps') self.add(menu_item) shortcut = frontpage.Shortcut( 'shortcut-minetest', info.name, short_description=info.short_description, icon=info.icon_filename, description=info.description, configure_url=reverse_lazy('minetest:index'), clients=info.clients, login_required=False) self.add(shortcut) packages = Packages('packages-minetest', ['minetest-server'] + _mods) self.add(packages) firewall = Firewall('firewall-minetest', info.name, ports=['minetest-plinth'], is_external=True) self.add(firewall) daemon = Daemon('daemon-minetest', 'minetest-server', listen_ports=[(30000, 'udp4')]) self.add(daemon) users_and_groups = UsersAndGroups( 'users-and-groups-minetest', reserved_usernames=['Debian-minetest']) self.add(users_and_groups) backup_restore = BackupRestore('backup-restore-minetest', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info( app_id=self.app_id, version=self._version, name=_('WordPress'), icon_filename='wordpress', short_description=_('Website and Blog'), description=_description, manual_page='WordPress', clients=manifest.clients, donation_url='https://wordpressfoundation.org/donate/') self.add(info) menu_item = menu.Menu('menu-wordpress', info.name, info.short_description, info.icon_filename, 'wordpress:index', parent_url_name='apps') self.add(menu_item) shortcut = frontpage.Shortcut('shortcut-wordpress', info.name, short_description=info.short_description, icon=info.icon_filename, url='/wordpress/', clients=info.clients) self.add(shortcut) # Add php to avoid wordpress package bringing in lib-apache2-mod-php. # WordPress only supports MySQL/MariaDB as database server. packages = Packages( 'packages-wordpress', [ 'wordpress', # Avoid WordPress package bringing in libapache2-mod-php 'php', # Optional, for performance 'php-imagick', # Optional, to upload plugins/themes using SSH connection 'php-ssh2', # Optional, for performance 'php-zip', # WordPress only supports MySQL/MariaDB as DB 'default-mysql-server', ]) self.add(packages) firewall = Firewall('firewall-wordpress', info.name, ports=['http', 'https'], is_external=True) self.add(firewall) webserver = Webserver('webserver-wordpress', 'wordpress-freedombox', urls=['https://{host}/wordpress/']) self.add(webserver) daemon = Daemon('daemon-wordpress', 'wordpress-freedombox.timer') self.add(daemon) backup_restore = WordPressBackupRestore('backup-restore-wordpress', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, name=_('Radicale'), icon_filename='radicale', short_description=_('Calendar and Addressbook'), description=_description, manual_page='Radicale', clients=manifest.clients) self.add(info) menu_item = menu.Menu('menu-radicale', info.name, info.short_description, info.icon_filename, 'radicale:index', parent_url_name='apps') self.add(menu_item) shortcut = frontpage.Shortcut('shortcut-radicale', info.name, short_description=info.short_description, icon=info.icon_filename, url='/radicale/', clients=info.clients, login_required=True) self.add(shortcut) packages = Packages('packages-radicale', ['radicale']) self.add(packages) firewall = Firewall('firewall-radicale', info.name, ports=['http', 'https'], is_external=True) self.add(firewall) webserver = Webserver('webserver-radicale', 'radicale2-freedombox', urls=['https://{host}/radicale']) self.add(webserver) uwsgi = Uwsgi('uwsgi-radicale', 'radicale') self.add(uwsgi) users_and_groups = UsersAndGroups('users-and-groups-radicale', reserved_usernames=['radicale']) self.add(users_and_groups) backup_restore = BackupRestore('backup-restore-radicale', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info( app_id=self.app_id, version=self._version, name=_('Privoxy'), icon_filename='privoxy', short_description=_('Web Proxy'), description=_description, manual_page='Privoxy', donation_url='https://www.privoxy.org/faq/general.html#DONATE') self.add(info) menu_item = menu.Menu('menu-privoxy', info.name, info.short_description, info.icon_filename, 'privoxy:index', parent_url_name='apps') self.add(menu_item) shortcut = frontpage.Shortcut( 'shortcut-privoxy', info.name, short_description=info.short_description, icon=info.icon_filename, description=info.description, configure_url=reverse_lazy('privoxy:index'), login_required=True) self.add(shortcut) packages = Packages('packages-privoxy', ['privoxy']) self.add(packages) firewall = Firewall('firewall-privoxy', info.name, ports=['privoxy'], is_external=False) self.add(firewall) daemon = Daemon('daemon-privoxy', 'privoxy', listen_ports=[(8118, 'tcp4'), (8118, 'tcp6')]) self.add(daemon) users_and_groups = UsersAndGroups('users-and-groups-privoxy', reserved_usernames=['privoxy']) self.add(users_and_groups) backup_restore = BackupRestore('backup-restore-privoxy', **manifest.backup) self.add(backup_restore)
def test_packages_init(): """Test initialization of packages component.""" component = Packages('test-component', ['foo', 'bar']) assert component.possible_packages == ['foo', 'bar'] assert component.component_id == 'test-component' assert not component.skip_recommends assert component.conflicts is None assert component.conflicts_action is None with pytest.raises(ValueError): Packages(None, []) component = Packages('test-component', [], skip_recommends=True, conflicts=['conflict1', 'conflict2'], conflicts_action=Packages.ConflictsAction.IGNORE) assert component.possible_packages == [] assert component.skip_recommends assert component.conflicts == ['conflict1', 'conflict2'] assert component.conflicts_action == Packages.ConflictsAction.IGNORE
def test_packages_find_conflicts(packages_installed_): """Test finding conflicts.""" packages_installed_.return_value = [] component = Packages('test-component', ['package3', 'package4']) assert component.find_conflicts() is None packages_installed_.return_value = [] component = Packages('test-component', ['package3', 'package4'], conflicts=['package5', 'package6'], conflicts_action=Packages.ConflictsAction.IGNORE) assert component.find_conflicts() == [] packages_installed_.return_value = ['package1', 'package2'] component = Packages('test-component', ['package3', 'package4'], conflicts=['package1', 'package2'], conflicts_action=Packages.ConflictsAction.IGNORE) assert component.find_conflicts() == ['package1', 'package2']
def __init__(self): """Create components for the app.""" super().__init__() groups = {'i2p': _('Manage I2P application')} info = app_module.Info( app_id=self.app_id, version=self._version, name=_('I2P'), icon_filename='i2p', short_description=_('Anonymity Network'), description=_description, manual_page='I2P', clients=manifest.clients, donation_url='https://geti2p.net/en/get-involved/donate') self.add(info) menu_item = menu.Menu('menu-i2p', info.name, info.short_description, info.icon_filename, 'i2p:index', parent_url_name='apps') self.add(menu_item) shortcut = frontpage.Shortcut('shortcut-i2p', info.name, short_description=info.short_description, icon=info.icon_filename, url='/i2p/', clients=info.clients, login_required=True, allowed_groups=list(groups)) self.add(shortcut) packages = Packages('packages-i2p', ['i2p']) self.add(packages) firewall = Firewall('firewall-i2p-web', info.name, ports=['http', 'https'], is_external=True) self.add(firewall) firewall = Firewall('firewall-i2p-proxies', _('I2P Proxy'), ports=tunnels_to_manage.values(), is_external=False) self.add(firewall) webserver = Webserver('webserver-i2p', 'i2p-freedombox', urls=['https://{host}/i2p/']) self.add(webserver) daemon = Daemon('daemon-i2p', 'i2p', listen_ports=[(7657, 'tcp6')]) self.add(daemon) users_and_groups = UsersAndGroups('users-and-groups-i2p', groups=groups) self.add(users_and_groups) backup_restore = BackupRestore('backup-restore-i2p', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, name=_('JSXC'), icon_filename='jsxc', short_description=_('Chat Client'), description=_description, manual_page='JSXC', clients=manifest.clients) self.add(info) menu_item = menu.Menu('menu-jsxc', info.name, info.short_description, info.icon_filename, 'jsxc:index', parent_url_name='apps') self.add(menu_item) shortcut = frontpage.Shortcut('shortcut-jsxc', name=info.name, short_description=info.short_description, icon=info.icon_filename, url=reverse_lazy('jsxc:jsxc'), clients=info.clients) self.add(shortcut) packages = Packages('packages-jsxc', ['libjs-jsxc']) self.add(packages) firewall = Firewall('firewall-jsxc', info.name, ports=['http', 'https'], is_external=True) self.add(firewall) directory_map = { '/static/jsxc/img': '/usr/share/libjs-jsxc/img/', '/static/jsxc/libjs-jsxc/lib': '/usr/share/javascript/jsxc/lib/', '/static/jsxc/libjs-jsxc/sound': '/usr/share/libjs-jsxc/sound/', '/static/jsxc/libjs-jsxc/': '/usr/share/libjs-jsxc/css/', } static_files = StaticFiles('static-files-jsxc', directory_map=directory_map) self.add(static_files) backup_restore = BackupRestore('backup-restore-jsxc', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, name=_('Quassel'), icon_filename='quassel', short_description=_('IRC Client'), description=_description, manual_page='Quassel', clients=manifest.clients) self.add(info) menu_item = menu.Menu('menu-quassel', info.name, info.short_description, info.icon_filename, 'quassel:index', parent_url_name='apps') self.add(menu_item) shortcut = frontpage.Shortcut( 'shortcut-quassel', info.name, short_description=info.short_description, icon=info.icon_filename, description=info.description, configure_url=reverse_lazy('quassel:index'), clients=info.clients, login_required=True) self.add(shortcut) packages = Packages('packages-quassel', ['quassel-core']) self.add(packages) firewall = Firewall('firewall-quassel', info.name, ports=['quassel-plinth'], is_external=True) self.add(firewall) letsencrypt = LetsEncrypt( 'letsencrypt-quassel', domains=get_domains, daemons=['quasselcore'], should_copy_certificates=True, private_key_path='/var/lib/quassel/quasselCert.pem', certificate_path='/var/lib/quassel/quasselCert.pem', user_owner='quasselcore', group_owner='quassel', managing_app='quassel') self.add(letsencrypt) daemon = Daemon('daemon-quassel', 'quasselcore', listen_ports=[(4242, 'tcp4'), (4242, 'tcp6')]) self.add(daemon) users_and_groups = UsersAndGroups('users-and-groups-quasselcore', reserved_usernames=['quasselcore']) self.add(users_and_groups) backup_restore = BackupRestore('backup-restore-quassel', **manifest.backup) self.add(backup_restore)
def test_diagnose(cache): """Test checking for latest version of the package.""" cache.return_value = { 'package2': Mock(candidate=Mock(version='2.0', is_installed=True)), 'package3': Mock(candidate=Mock(version='3.0', is_installed=False)), 'package7': Mock(candidate=Mock(version='4.0', is_installed=True)), } component = Packages('test-component', [ 'package1', 'package2', 'package3', Package('package4') | Package('package5'), Package('package6') | Package('package7') ]) results = component.diagnose() assert 'not available for install' in results[0][0] assert results[0][1] == 'failed' assert '(2.0)' in results[1][0] assert results[1][1] == 'passed' assert '(3.0)' in results[2][0] assert results[2][1] == 'warning' assert 'not available for install' in results[3][0] assert results[3][1] == 'failed' assert '(4.0)' in results[4][0] assert results[4][1] == 'passed'
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(self.app_id, self._version, name=_('bepasty'), icon_filename='bepasty', short_description=_('File & Snippet Sharing'), description=_description, manual_page='bepasty', clients=manifest.clients) self.add(info) menu_item = menu.Menu('menu-bepasty', info.name, info.short_description, info.icon_filename, 'bepasty:index', parent_url_name='apps') self.add(menu_item) shortcut = frontpage.Shortcut('shortcut-bepasty', info.name, info.short_description, info.icon_filename, '/bepasty', clients=manifest.clients) self.add(shortcut) packages = Packages('packages-bepasty', ['bepasty']) self.add(packages) firewall = Firewall('firewall-bepasty', info.name, ports=['http', 'https'], is_external=True) self.add(firewall) uwsgi = Uwsgi('uwsgi-bepasty', 'bepasty-freedombox') self.add(uwsgi) webserver = Webserver('webserver-bepasty', 'bepasty-freedombox', urls=['https://{host}/bepasty/']) self.add(webserver) backup_restore = BackupRestore('backup-restore-bepasty', **manifest.backup) self.add(backup_restore)
def __init__(self): """Create components for the app.""" super().__init__() info = app_module.Info(app_id=self.app_id, version=self._version, name=_('infinoted'), icon_filename='infinoted', short_description=_('Gobby Server'), description=_description, manual_page='Infinoted', clients=manifest.clients) self.add(info) menu_item = menu.Menu('menu-infinoted', info.name, info.short_description, info.icon_filename, 'infinoted:index', parent_url_name='apps') self.add(menu_item) shortcut = frontpage.Shortcut( 'shortcut-infinoted', info.name, short_description=info.short_description, icon=info.icon_filename, description=info.description, configure_url=reverse_lazy('infinoted:index'), clients=info.clients, login_required=False) self.add(shortcut) packages = Packages('packages-infinoted', ['infinoted']) self.add(packages) firewall = Firewall('firewall-infinoted', info.name, ports=['infinoted-plinth'], is_external=True) self.add(firewall) daemon = Daemon('daemon-infinoted', 'infinoted', listen_ports=[(6523, 'tcp4'), (6523, 'tcp6')]) self.add(daemon) backup_restore = BackupRestore('backup-restore-infinoted', **manifest.backup) self.add(backup_restore)