Code Monkey home page Code Monkey logo

egicli's Introduction

DEPRECATED EGI CLI: A command line for EGI Federation

egicli is no longer under active maintenance. Please use fedcloudclient for a command line interface tool to interact with the EGI Cloud providers

egicli's People

Contributors

andrea-manzi avatar cloudbustinguk avatar enolfc avatar kira2600 avatar kstepanovdev avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

egicli's Issues

Env vars for the endpoint commands are not working

Description of the issue

Running the egicli container, i noticed that the EGI_SITE and OS_PROJECT_ID env vars are not taken into account when using the endpoint commands

For instance

root@13edf12cb07e:~# export EGI_SITE=INFN-CATANIA-STACK


root@13edf12cb07e:~# egicli --debug endpoint projects 
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): aai.egi.eu:443
DEBUG:urllib3.connectionpool:https://aai.egi.eu:443 "GET /oidc/.well-known/openid-configuration HTTP/1.1" 200 None
DEBUG:urllib3.connectionpFool:Starting new HTTPS connection (1): aai.egi.eu:443
DEBUG:urllib3.connectionpool:https://aai.egi.eu:443 "POST /oidc/token HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): goc.egi.eu:443
DEBUG:urllib3.connectionpool:https://goc.egi.eu:443 "GET /gocdbpi/public/?method=get_site_list&certification_status=Certified HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): goc.egi.eu:443
DEBUG:urllib3.connectionpool:https://goc.egi.eu:443 "GET /gocdbpi/public/?method=get_service_endpoint&service_type=org.openstack.nova&monitored=Y HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.cloud.ifca.es:5000
DEBUG:urllib3.connectionpool:https://api.cloud.ifca.es:5000 "POST /v3/OS-FEDERATION/identity_providers/egi.eu/protocols/openid/auth HTTP/1.1" 201 495
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.cloud.ifca.es:5000
DEBUG:urllib3.connectionpool:https://api.cloud.ifca.es:5000 "GET /v3/auth/projects HTTP/1.1" 200 414
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): sbgcloud.in2p3.fr:5000
DEBUG:urllib3.connectionpool:https://sbgcloud.in2p3.fr:5000 "POST /v3/OS-FEDERATION/identity_providers/egi.eu/protocols/openid/auth HTTP/1.1" 401 114
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): sbgcloud.in2p3.fr:5000
DEBUG:urllib3.connectionpool:https://sbgcloud.in2p3.fr:5000 "POST /v3/OS-FEDERATION/identity_providers/egi.eu/protocols/oidc/auth HTTP/1.1" 401 197
Traceback (most recent call last):
  File "/usr/local/bin/egicli", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/egicli/endpoint.py", line 165, in projects
    unscoped_token, _ = get_unscoped_token(os_auth_url, access_token)
  File "/usr/local/lib/python3.8/site-packages/egicli/endpoint.py", line 85, in get_unscoped_token
    raise RuntimeError("Unable to get an scoped token")
RuntimeError: Unable to get an scoped token

In this case an incorrect endpoint is invoked instead of the one from Catania

DEBUG:urllib3.connectionpool:https://sbgcloud.in2p3.fr:5000 "POST /v3/OS-FEDERATION/identity_providers/egi.eu/protocols/oidc/auth HTTP/1.1" 401 197

while if i pass the --site option it works as exptected

egicli --debug endpoint projects --site INFN-CATANIA-STACK
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): aai.egi.eu:443
DEBUG:urllib3.connectionpool:https://aai.egi.eu:443 "GET /oidc/.well-known/openid-configuration HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): aai.egi.eu:443
DEBUG:urllib3.connectionpool:https://aai.egi.eu:443 "POST /oidc/token HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): goc.egi.eu:443
DEBUG:urllib3.connectionpool:https://goc.egi.eu:443 "GET /gocdbpi/public/?method=get_service_endpoint&service_type=org.openstack.nova&monitored=Y&sitename=INFN-CATANIA-STACK HTTP/1.1" 200 976
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): stack-server.ct.infn.it:35357
DEBUG:urllib3.connectionpool:https://stack-server.ct.infn.it:35357 "POST /v3/OS-FEDERATION/identity_providers/egi.eu/protocols/openid/auth HTTP/1.1" 201 495
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): stack-server.ct.infn.it:35357
DEBUG:urllib3.connectionpool:https://stack-server.ct.infn.it:35357 "GET /v3/auth/projects HTTP/1.1" 200 408
id                                Name      enabled    site
--------------------------------  --------  ---------  ------------------
00982464978c4b61a5f570e315251f02  TRAINING  True       INFN-CATANIA-STACK

same for endpoint env command

root@13edf12cb07e:~# export OS_PROJECT_ID=00982464978c4b61a5f570e315251f02

root@13edf12cb07e:~# egicli endpoint env
Usage: egicli endpoint env [OPTIONS]
Try "egicli endpoint env --help" for help.

Error: Missing option "--project-id".

while when using the option --project-id is working fine

egicli endpoint env --project-id=00982464978c4b61a5f570e315251f02
# environment for INFN-CATANIA-STACK
export OS_AUTH_URL="https://stack-server.ct.infn.it:35357/v3"
export OS_AUTH_TYPE="v3oidcaccesstoken"
export OS_IDENTITY_PROVIDER="egi.eu"
export OS_PROTOCOL="openid"
...

Post() got multiple values for argument 'data'

Traceback (most recent call last):
  File "/usr/local/bin/egicli", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/egicli/endpoint.py", line 278, in token
    checkin_client_id, checkin_client_secret, checkin_refresh_token, checkin_url
  File "/usr/local/lib/python3.6/dist-packages/egicli/checkin.py", line 45, in refresh_access_token
    oidc_ep["token_endpoint"],
  File "/usr/local/lib/python3.6/dist-packages/egicli/checkin.py", line 32, in token_refresh
    r = requests.post(token_url, auth, data=refresh_data)
TypeError: post() got multiple values for argument 'data'

Hotfix auth

checkin.py

auth=None
if checkin_client_secret:
    auth=(checkin_client_id, checkin_client_secret)
    refresh_data.update({"client_secret": checkin_client_secret})
r = requests.post(token_url, auth=None, data=refresh_data)
r.raise_for_status()
return r.json()

r = requests.post(token_url, auth=None, data=refresh_data)

should be like this:

r = requests.post(token_url, auth, data=refresh_data)

Generate config for ec3/im

Short Description of the issue

We should be able to generate a config file for using it in ec3:

something like:
id = cesnetostegi; type = OpenStack; host = https://identity.cloud.muni.cz; username = egi.eu; tenant = openid; domain = panosc.eu; auth_version = 3.x_oidc_access_token; password = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'

we can either throw that to stdout or store it in a default location.
If access tokens are to be used, these need to refreshed accordingly.

Summary of proposed changes

egicli endpoint env should allow to directly set the environment

egicli endpoint env should allow to directly set the environment: currently it prints what should be set but doesn't set it and one can use it like this:

egicli endpoint env --site XXXX --project-id yyyyyyy | tee cloud-env.sh
source cloud-env.sh

But when the token will have expired it will be required to re-rerun the command and re-source the env file. It would be convenient to be able to do

egicli endpoint env --site XXXX --project-id yyyyyyy --set
# Another alternative could be to have a setenv subcommand
egicli endpoint setenv --site XXXX --project-id yyyyyyy
# with potentially a --print option to replace the env command
egicli endpoint setenv --site XXXX --project-id yyyyyyy --print

Automate generation of releases

Short Description of the issue

Automate the release build process, pushing docker images and packages to pypi

Summary of proposed changes

Better cert support

Short Description of the issue

Better document how to deal with certificates

Summary of proposed changes

Add proper testing

Short Description of the issue

Tests are always nice :)

Summary of proposed changes

GGUS ticket 146086

Hello,
Regarding ticket 146086 in GGUS.
Looks like that it is related with python versions.

After debug I've found that an issue in data type that sends to server
I've changed the data type that we need to send r = requests.post(url, data=json.dumps(body)) to r = requests.post(url, json=body) and request was sent successfully.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.