Bug 814563 - [RFE] Create a simple way how to run tests or part of them as ordinary user
Summary: [RFE] Create a simple way how to run tests or part of them as ordinary user
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: rawhide
Hardware: Unspecified
OS: Unspecified
low
unspecified
Target Milestone: ---
Assignee: Ondrej Hudlicky
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-04-20 06:46 UTC by Patrik Kis
Modified: 2016-09-20 02:12 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 677668 0 medium CLOSED RFE: rlRun for non-root users ? 2021-02-22 00:41:40 UTC

Internal Links: 677668

Description Patrik Kis 2012-04-20 06:46:16 UTC
Description of problem:

By default all tests in beaker are run as user root, however it is not always required. Many test cases could/should be tested as ordinary user but it is not done because with current BeakerLib functions it is not really comfortable:
1. create a user
2. set the environment
3. since permanently swiths to that user by su is not an option here, every command has to run through su/sudo
etc

Goal:
If there was a simple/easy way how to switch to ordinary user, run commands and BeakerLib functions, collect the result log files, etc. it would significantly improve the test efficiency.

How to do:
Just an idea (I did not investigate yet how it could be implemented):
1. BeakerLib function: rlUserStart [username]/rlUserEnd [username] [file, ...]
- the user could be transparently created and destroyed, if username not given, generate a random
- all commands between these functions would run as the new user
- in ideal case these functions could be even nested (switch between more users)
- created log files collected when the user is destroyed, saved in working directory, set the rights, etc

Any ideas are welcomed; a brainstorming session could help to collect the ideas: the point is to make the usage as simple as possible so people start to use it

Comment 1 Petr Muller 2012-04-23 14:02:51 UTC
The 'run whole test' as user is a Beaker harness thing, maybe a tortilla wrapper. I presume some RFEs for report-result and other beaker harness API pieces would be needed to allow running them as non-root. That is definitely not a BeakerLib material.

The 'run parts of the test' as different user is a different story. There is a RFE hanging somewhere around for something like a 'rlRunAsUser', which is the approach I personally like and it mimics the use-case I usually encounter when writing tests. An option is to rewrite rlRun to accept a -u 'user' arg.

The proposal seems quite hard to implement to me (after all, the test is just a bash script), and I do not see a benefit over the simple rlRunAsUser approach.

Comment 2 Patrik Kis 2012-04-24 13:27:52 UTC
If there were something like 'rlRunAsUser', this RFE would not be created. I agree that it could be easier to implement something like 'rlRunAsUser', however run a block of commands as different user is more comfortable, but this is a detail.
The main point for me is to have at least something that would make the life easier, if it is 'rlRunAsUser', so be but I haven't found such a RFE.


Note You need to log in before you can comment on or make changes to this bug.