[Avocado-devel] [RFC] Environment Variables - V2

Lukáš Doktor ldoktor at redhat.com
Wed Jun 15 09:24:34 UTC 2016


Dne 15.6.2016 v 11:20 Lukáš Doktor napsal(a):
> Dne 10.6.2016 v 11:20 Amador Pahim napsal(a):
>> Hi
>>
>> After some discussion about the V1, this is the V2 of the RFC on
>> Environment Variables.
>>
>> The original request is here:
>> https://trello.com/c/Ddcly0oG/312-mechanism-to-provide-environment-variables-to-tests-run-on-a-virtual-machine-remote
>>
>>
>>
>> Motivation
>> ==========
>> When Avocado is executed locally, it has access to the local environment
>> variables, including that ones set by the user. For remote executions,
>> like using remote or vm plugins, the local environment variables are not
>> reflected on the remote environment. The motivation of this RFC is to
>> provide the standard Unix interface of environment variables for when
>> tests are run remotely.
>>
>> Use case
>> ========
>> - User defines an environment variable locally:
>>
>>  $ export FOOVAR=myfoovar
>>
>> - User runs avocado using a remote plugin, pointing the local
>> environment variable(s) he wants to keep the in the remote environment:
>>
>>  $ avocado --env-keep FOOVAR run passtest.py --remote-hostname host01
>>
>> - The environment variable defined locally will be present on host01
>> environment.
>>
>> Alternative flow:
>>
>>  - Instead of pointing in the command line the local environment
>> variable(s) he wants to keep the in the remote environment, uses can set
>> it in avocado.conf so it will affect every Avocado execution.
>>
>> Proposal
>> ========
>> - To create an Avocado command line option to set environment variables
>> that will be available in remote environment:
>>
>>  $ avocado --env-keep FOOVAR run passtest.py --remote-hostname host01
>>
>> - Create an option in config file with a list of environment variable
>> names to copy from Avocado local environment to the remote environment
>> (similar to env_keep in the /etc/sudoers file):
>>
>>  [remoter.behavior]
>>  env_keep = ['FOO', 'FOO1', 'FOO2']
> I don't think the config file would be necessary, but apart from that I
> agree with this. Maybe in the future we might need `--env-unset` as some
> ugly software checks for value presence even when the value is null.
Actually not, I noticed you're talking about generic `avocado` param. I 
think this should be `avocado run` only option, therefor the usage would be:

     $avocado run passtest.py --env-keep FOOVAR --remote-hostname host01

Another reason for using this is that `nargs='+'` would consume the 
`run` argument. So if we are to support `avocado --env-keep` than users 
would have to use `avocado --env-keep foo --env-keep bar run test` or 
we'd have to split the values ourselves (eg. using `,`).

Kind regards,
Lukáš

>
> Lukáš
>
>>
>>
>> Best Regards,
>
>
>
> _______________________________________________
> Avocado-devel mailing list
> Avocado-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/avocado-devel
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/avocado-devel/attachments/20160615/1ff258b0/attachment.sig>


More information about the Avocado-devel mailing list