Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Sudo. #11

Merged
merged 8 commits into from
Sep 12, 2018
Merged

Add support for Sudo. #11

merged 8 commits into from
Sep 12, 2018

Commits on Sep 12, 2018

  1. Add a new Sudo token.

    This will let us detect the need for sudo.
    Steve Kemp committed Sep 12, 2018
    Configuration menu
    Copy the full SHA
    ba5590e View commit details
    Browse the repository at this point in the history
  2. Add a Sudo flag to our statement.

    This will be set to true if the statement needs to be operated
    under the use of sudo.
    Steve Kemp committed Sep 12, 2018
    Configuration menu
    Copy the full SHA
    f6c31ad View commit details
    Browse the repository at this point in the history
  3. Added support for the sudo-handling.

    With this commit the `Run` and `IfChanged` tokens will honour
    the sudo-flag, if the appropriate token is seen.
    
    For example this is "normal":
    
            Run "/usr/bin/id"
    
    But this will run as root:
    
            Sudo Run "/usr/bin/id"
    
    (Of course we need support in the evaluator before this actually
    works; this is just the setup.)
    Steve Kemp committed Sep 12, 2018
    Configuration menu
    Copy the full SHA
    d579eed View commit details
    Browse the repository at this point in the history
  4. Actually allow sudo to work as expected.

    We scan the statements to be executed before we run them, and
    prompt for a sudo-password if the use of Sudo is in-place.
    
    We then execute our command(s) with sudo as appropriate.
    
    This makes our code functional.
    
    TODO:
    
    * More tests.
    Steve Kemp committed Sep 12, 2018
    Configuration menu
    Copy the full SHA
    19f3e82 View commit details
    Browse the repository at this point in the history
  5. 100% test-coverage for our parser

    Steve Kemp committed Sep 12, 2018
    Configuration menu
    Copy the full SHA
    bb0646a View commit details
    Browse the repository at this point in the history
  6. Document the Sudo-command

    Steve Kemp committed Sep 12, 2018
    Configuration menu
    Copy the full SHA
    16a5e7a View commit details
    Browse the repository at this point in the history
  7. Added example of using Sudo

    Steve Kemp committed Sep 12, 2018
    Configuration menu
    Copy the full SHA
    332a84f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e2e0bbe View commit details
    Browse the repository at this point in the history