Skip to content

Extend and use action utilities fully

Sunil Mohan Adapa requested to merge SunilMohanAdapa:action_utilities into master

Created by: SunilMohanAdapa

This patch is built on top of python3-augeas branch. Please merge that before this one. Those changes are showing up in here too.

In this merge request I propose a few simple changes with action utilities:

  • Use action utilities wherever possible. This is allows for more code sharing, better handling of edge cases (such as command output, error handling), fewer bugs and abstraction over low level stuff (such as apache vs others, systemd vs others).
  • Use systemctl enable/disable for enabling and disabling services instead of messy /etc/default/* files. This can be later extended to also use updaterc.d if need be.
  • Use actions only when super-user privileges are required:
    • 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.

Merge request reports

Loading