tdviet / fedcloudclient

EGI FedCloud Client
https://fedcloudclient.fedcloud.eu
MIT License
8 stars 10 forks source link

2.0-alpha1: OIDC_AGENT_ACCOUNT value not picked up from environment #188

Closed sebastian-luna-valero closed 1 year ago

sebastian-luna-valero commented 1 year ago

Initial checklist

Affected packages and versions

2.0-alpha1

Link to runnable example

No response

Steps to reproduce

The config value shown for oidc_agent_account:

fedcloud config show

parameter                 value
------------------------  -----
...
oidc_agent_account        egi
...

is not updated with configuring the environment variable OIDC_AGENT_ACCOUNT:

export OIDC_AGENT_ACCOUNT=myaccount
fedcloud config show

parameter                 value
------------------------  -----
...
oidc_agent_account        egi
...

Subsequently I get the error:

fedcloud openstack server list
Error getting access token from oidc-agent
Error message: No account configured with that short name
Error: An access token is needed for the operation. You can specify access token directly via --oidc-access-token option or use oidc-agent via --oidc-agent-account or mytoken via --mytoken

which is solved when I do

fedcloud openstack --oidc-agent-account myaccount server list

Expected behavior

export OIDC_AGENT_ACCOUNT=myaccount
fedcloud config show

parameter                 value
------------------------  -----
...
oidc_agent_account        myaccount
...

Actual behavior

export OIDC_AGENT_ACCOUNT=myaccount
fedcloud config show

Affected runtime and version

python@3.12

Affected package manager and version

No response

Affected OS and version

No response

Build and bundle tools

No response

sebastian-luna-valero commented 1 year ago

Solution is to do:

export FEDCLOUD_OIDC_AGENT_ACCOUNT=myaccount
fedcloud config show

instead of:

export OIDC_AGENT_ACCOUNT=myaccount
fedcloud config show
tdviet commented 1 year ago

Hi Sebastian, thank you for testing. In the 2.0 version, all envvar have uniform names FEDCLOUD_. Try

export FEDCLOUD_OIDC_AGENT_ACCOUNT=myaccount export FEDCLOUD_SITE=IISAS-FedCloud

and so on.

sebastian-luna-valero commented 1 year ago

Many thanks, Viet!

tdviet commented 1 year ago

Just for information, users may have multiple configuration files and set the actual one via envvar FEDCLOUD_CONFIG_FILE. That will enable easy switching between multiple project environments (default site, vo, token, log file, ...)

sebastian-luna-valero commented 1 year ago

Exactly, I remember that was the original purpose. Very useful indeed, many thanks!