18 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
65aadef546
actions: Hush some unneeded output of systemd 2016-09-04 14:47:28 -04:00
Sunil Mohan Adapa
ddc7e07ea1
Use shutil instead of distuils for which()
It is unusual to use distuils outside of setup scripts.
2016-08-26 21:51:55 -04:00
Sunil Mohan Adapa
9ba327f0dd
users: Fix issue with removing temp file 2016-07-31 15:06:20 +05:30
Sunil Mohan Adapa
8e28afe160
users: Move dpkg reconfigure to action utils
In the hope that it will be useful to other actions.  Also delete the
named temporary file after configuration.
2016-07-31 10:58:07 +05:30
nikhilrayaprolu
eca8b8d42e
checking for apache2 installation
- checking whether apache2 is configured or not before checking
  whether it is enabled

- changed python2 syntax to python3

- returning False
2016-07-24 10:41:02 -04:00
Sunil Mohan Adapa
3d5661dc60
action_utils: PEP8 fixes and minor changes 2016-06-03 16:22:06 -04:00
Sunil Mohan Adapa
d3f386733f
diagnostics: Use curl instead of wget for URLs
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.
2016-06-03 16:22:02 -04:00
Sunil Mohan Adapa
97b77e3719
diagnostics: Implement scoping for IPv6 addresses 2016-06-03 16:21:59 -04:00
Sunil Mohan Adapa
8d9480901b
action_utils: Limited fallback to sysvinit
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.
2016-05-21 16:06:29 -04:00
Sunil Mohan Adapa
5234bffb3b Don't restart webserver unnecessary
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.
2015-12-03 17:55:22 -05:00
Sunil Mohan Adapa
3df1a88824 Switch to Django i18n for code strings
Django i18n layer is on top of gettext and provide may crucial features
such as per-request locales, lazy translations etc.
2015-11-13 22:08:43 +05:30
James Valleroy
e7b68f7e28 diagnostics: Remove extra 'error' displayed results.
Just show 'error' for missing command.
2015-08-29 09:37:35 -04:00
James Valleroy
9a25e6b21d tor: Add torsocks as required package, needed for diagnostics.
Display error for diagnostic if command is missing.
2015-08-29 07:48:06 -04:00
Sunil Mohan Adapa
49c4c1dce6 diagnostics: Action helpers for modules
- Helper for checking whether a port is being listened on.

- Helper for checking whether a URL is accessible.

- Helper for checking whether a URL is accessible with all possible IPs
  and machine names.

- Helper for checking whether it is possible to connect to a port.
2015-08-29 06:22:01 -04:00
Sunil Mohan Adapa
ac19238e91 Add utilites for Apache configuration management 2015-07-19 19:54:13 -04:00
Sunil Mohan Adapa
07e2c0ce14 Don't use actions to check if service is running
- To check whether a service is running does not require root
  privileges.  This can directly be done from a module without any
  action.

- Since actions are allowed to be run using sudo, introducing
  unnecessary sub-commands increases attack surface.

- Simple functions calls are unnecessarily being converted to command
  line invocations and involve parsing response.

- There is a lot of repeated code because of this that can be
  eliminated.

- To generalize this, we need to make all non-root system operations
  directly from module instead of delegating to action commands.
2015-07-19 19:54:13 -04:00
Sunil Mohan Adapa
3b6af2f29c Use only action utilities for service management
- When disabling a service, ignore if unable to stop the service.
2015-07-19 19:54:13 -04:00
Sunil Mohan Adapa
517c364559 pagekite: Move to using python3-augeas
- Merge actions/pagekite_util.py into plinth/modules/pagekite/util.py.

- Rename plinth/modules/pagekite/util.py to utils.py.

- Add python-augeus as dependency.

- Move actions/util.py to plinth/action_utils.py and update services
  that use it.

- Rename _run() method to run() as it is being used publicly.

- Import the utils in a more conventional manner.

- Move all python2 bits to python3.
2015-07-19 15:37:43 -04:00