Skip to content

Commit

Permalink
[sonic-package-manager] Drop 'expires_in' (#2002)
Browse files Browse the repository at this point in the history
#### What I did

The 'expires_in' attribute for tokens is defined as optional and some
Docker repositories (notably ghcr.io) do not set it.

#### How I did it

Since 'expires_in' is not used anywhere in the code, we simply drop it.

#### How to verify it

Try to install a SONiC package from `ghcr.io`. E.g.:

```
sudo sonic-package-manager install --from-repository ghcr.io/kamelnetworks/sonic_exporter:main
```

#### Previous command output (if the output of a command-line utility has changed)

```
ghcr.io/kamelnetworks/sonic_exporter:main is going to be installed, continue? [y/N]: y
Failed to install ghcr.io/kamelnetworks/sonic_exporter:main: 'expires_in'
```

#### New command output (if the output of a command-line utility has changed)

Output as expected
  • Loading branch information
bluecmd authored Aug 26, 2022
1 parent 52ac8ac commit 666bdc0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions sonic_package_manager/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ def get_token(bearer: Dict) -> str:

content = json.loads(response.content)
token = content['token']
expires_in = content['expires_in']

log.debug(f'authentication token for bearer={bearer}: '
f'token={token} expires_in={expires_in}')
f'token={token}')

return token

Expand Down

0 comments on commit 666bdc0

Please sign in to comment.