-
Notifications
You must be signed in to change notification settings - Fork 20
WIP: porting from internal/connect
to pkg/
#289
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These two utility functions serve as safeguards for our binaries on `cmd`. This has been abstracted away from original code from SUSEConnect, but they are good candidates on the other binaries as well. The EnsureZypper is now being called by `zypper-search-packages` and `zypper-migration` as these two binaries are useless outside of non-Linux and non-zypper. Signed-off-by: Miquel Sabaté Solà <[email protected]>
We are moving away from messy global variables that are littering the `internal` packages, and which have been bringing problems in the past. This commit introduces the Options struct, which is in scope similar to the one on `pkg/` and that will bear all the info needed to conduct all SUSEConnect operations. This struct will surely need a revisit after all the move is done, but for now a simple "rename" from Config should cut it. Last but not least, notice that we are not yet dropping CFG entirely from either SUSEConnect nor zypper-migration. This is because the internal library is still littered with the usage of the CFG global variable. This is left to be done by subsequent commits. Signed-off-by: Miquel Sabaté Solà <[email protected]>
There was no need to use the mock library nor testing some corner cases which will surely never happen. Let's reduce the scope of these tests and focus on what can actually happen with the function at hand. Signed-off-by: Miquel Sabaté Solà <[email protected]>
Signed-off-by: Miquel Sabaté Solà <[email protected]>
531ccaa
to
0fc05b9
Compare
The connection.Credentials interface is an abstraction that we came up for all sorts of usages, but in the end it was meant to be easily used by our current implementation on `internal/credentials`, where all sorts of credential files are being used and parsed. This commit adds the needed functions to our internal implementation in order to implement the connection.Credentials interface, which they are just getters/setters. In the future a lot of functions from internal's credentials could be scrapped, but this is left for future functionality. Signed-off-by: Miquel Sabaté Solà <[email protected]>
A new wrapper has been introduced in order to target the API via the `pkg/` interfaces. This is a bridge between our internal credentials' implementation and the Connection interface. Signed-off-by: Miquel Sabaté Solà <[email protected]>
Product statuses and activations have been moved from `internal` to `pkg`. This also had as a side-effect the need to change some other (apparently unrelated) code, but it mainly boils down on using the new Options (and fields) as new parameters for the functions that were relying on global state. Signed-off-by: Miquel Sabaté Solà <[email protected]>
Instead of passing a jsonFlag boolean around, simply add a proper enum value into the Options struct. This allows for some refactoring on how messages are to be formatted. Signed-off-by: Miquel Sabaté Solà <[email protected]>
These two functions have been superseeded by code on `pkg/registration`, and they are no longer needed. Signed-off-by: Miquel Sabaté Solà <[email protected]>
The code on `pkg` assumes that the credentials file is either there or that it can be created when writing to it for the first time, but this is slightly different from the old `internal` implementation. In there, upon calling `Register`, the system would be announced and then it would get the credentials. With that the file would then be created. To remedy this, if `ReadCredentials` fail when setting up the wrapper on the `internal/connect` package, then at least the credentials path is set. This will allow the credentials file to be created whenever `SetLogin` is called since at least we have the path. Signed-off-by: Miquel Sabaté Solà <[email protected]>
Signed-off-by: Miquel Sabaté Solà <[email protected]>
Signed-off-by: Miquel Sabaté Solà <[email protected]>
0fc05b9
to
d057f32
Compare
Rebasing to the new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.