Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for the System-Token header #138

Merged
merged 1 commit into from
Jul 26, 2022

Conversation

mssola
Copy link
Contributor

@mssola mssola commented Jul 19, 2022

Description

In order to detect system duplicates, SCC implemented a System-Token mechanism in which systems are to report a token that is generated for every request from systems.

The Ruby implementation of SUSEConnect stores this into the credentials file for every request. If the response did not contain any token (e.g. first time that a system contacts SCC or upgrading from and older SUSEConnect) then an empty token is stored into the credentials file. All in all, this commit brings this Go implementation on par with the Ruby one when it comes to detecting system duplicates.

How to test this

  1. Build with the latest changes.
  2. Run any request (e.g. the recently added --keepalive command)
  3. Check that the system credentials have changed by adding a new system_token value.
  4. Check that the system from Glue's database has updated its system_token column.

Retry steps 2, 3 and 4 multiple times and check that the system_token field keeps being in sync.

Related issues

Fixes #125

@mssola
Copy link
Contributor Author

mssola commented Jul 19, 2022

djoreilly
djoreilly previously approved these changes Jul 19, 2022
Copy link
Collaborator

@djoreilly djoreilly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

internal/connect/api.go Outdated Show resolved Hide resolved
In order to detect system duplicates, SCC implemented a `System-Token`
mechanism in which systems are to report a token that is generated for
every request from systems.

The Ruby implementation of SUSEConnect stores this into the credentials
file for every request. If the response did not contain any token (e.g.
first time that a system contacts SCC or upgrading from and older
SUSEConnect) then an empty token is stored into the credentials file.
All in all, this commit brings this Go implementation on par with the
Ruby one when it comes to detecting system duplicates.

Fixes #125

Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Copy link
Contributor

@ngetahun ngetahun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mssola mssola merged commit b1262f4 into main Jul 26, 2022
@mssola mssola deleted the add-system-token-header-support branch July 26, 2022 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: handle the System-Token header
4 participants