wfau / gaia-dmp

Gaia data analysis platform
GNU General Public License v3.0
1 stars 5 forks source link

Sanity check project credentials #1282

Closed Zarquan closed 4 months ago

Zarquan commented 4 months ago

If we get our credentials mixed up it can cause all kinds of odd side effects. Worst case is we think we are using credentials for blue when we are passing credentials for data.

We need a small script that compares the cloud name that we think we are looking at with the cloud name that openstack thinks we are looking at.

# Issue a token to get the current project ID.
openstack \
          --os-cloud "${cloudname}" \
          token issue \
            --format json
    {
      "expires": "2024-02-09T17:47:33+0000",
      "id": "gAAA.......ibPGhx",
      "project_id": "e918a13fed2648758175a15fac083569",
      "user_id": "5fa0....c6b17"
    }

# Use the project ID to check the name.
openstack \
    --os-cloud "${cloudname}" \
    project show \
        --format json \
        'e918a13fed2648758175a15fac083569'

    {
      "description": "IRIS@Cambridge Gaia-Blue",
      "domain_id": "default",
      "enabled": true,
      "id": "e918a13fed2648758175a15fac083569",
      "is_domain": false,
      "name": "iris-gaia-blue",
      "options": {},
      "parent_id": "default",
      "tags": []
    }

# Compare the project name from openstack with ours to check.