-
Notifications
You must be signed in to change notification settings - Fork 74
Registration crate #2915
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
Merged
Merged
Registration crate #2915
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
fc26e3b
initial version of suseconnect wrapper
jreidinger 4c8bb07
add initial example of call for announce call
jreidinger ab24eee
Merge branch 'api-v2' into registration_crate
jreidinger b718e1c
avoid memory leak
jreidinger 782172e
Merge remote-tracking branch 'origin/api-v2' into registration_crate
jreidinger 9698703
adapt code and add generated test cases
jreidinger 77e2d39
add remaining errors from suseconnect
jreidinger a498174
add wrapper for creating credentials file with test
jreidinger 9767c0b
add reload certificates call that is needed when we import SSL cert f…
jreidinger 09c8cff
add activate_product method
jreidinger 5fbb021
add write config method and do cargo fmt
jreidinger f1bf4b7
add show_product binding to be able to display base product extensions
jreidinger e233088
cargo fmt
jreidinger c6d7dab
Merge branch 'api-v2' into registration_crate
jreidinger 6205d27
install libsuseconnect properly
jreidinger 0f0de44
Apply suggestions from code review
jreidinger febc5ce
changes from review
jreidinger 7477533
cargo fmt
jreidinger d92431d
Merge branch 'api-v2' into registration_crate
jreidinger f2af3ca
changes from review
jreidinger 17a7c4d
Merge branch 'api-v2' into registration_crate
jreidinger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| [package] | ||
| name = "suseconnect-agama" | ||
| version = "0.1.0" | ||
| rust-version.workspace = true | ||
| edition.workspace = true | ||
|
|
||
| [lib] | ||
| name = "suseconnect_agama" | ||
| path = "src/lib.rs" | ||
|
|
||
| [dependencies] | ||
| serde = { version = "1.0.228", features = ["derive"] } | ||
| serde_json = "1.0.140" | ||
| suseconnect-agama-sys = { path="./suseconnect-agama-sys" } | ||
| thiserror = "2.0.16" | ||
| tracing = "0.1.41" | ||
| url = "2.5.4" | ||
|
|
||
| [dev-dependencies] | ||
| tempfile = "3.20.0" | ||
| tracing-subscriber = "0.3.20" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| use std::env; | ||
|
|
||
| use suseconnect_agama::{announce_system, ConnectParams}; | ||
|
|
||
| pub fn main() { | ||
| tracing_subscriber::fmt::init(); | ||
| let args: Vec<String> = env::args().collect(); | ||
| let Some(code) = args.get(1) else { | ||
| eprintln!("Provide reg code as first parameter"); | ||
| return; | ||
| }; | ||
|
|
||
| let params = ConnectParams { | ||
| language: Some("en_US".to_string()), | ||
| url: None, | ||
| token: Some(code.to_string()), | ||
| email: None, | ||
| }; | ||
|
|
||
| let result = announce_system(params, "sles16"); | ||
| println!("{:?}", result); | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| use suseconnect_agama::{show_product, ConnectParams, ProductSpecification}; | ||
|
|
||
| // Note: the example has to be run on registered SLES 16, otherwise it returns different errors | ||
| pub fn main() { | ||
| tracing_subscriber::fmt::init(); | ||
|
|
||
| let product_spec = ProductSpecification { | ||
| identifier: "SLES".to_string(), | ||
| version: "16.0".to_string(), | ||
| arch: "x86_64".to_string(), | ||
| }; | ||
| let params = ConnectParams::default(); | ||
|
|
||
| let result = show_product(product_spec, params); | ||
| println!("{:?}", result); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is just a testing example, but how difficult would be to detect the real current architecture? We need it in the real code anyway...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, in original code we use rpm arch...sadly using
zypper system-architecturereturns different string, so it would probably need a bit of processing. I kind of hope that we can get rpm architecture from libzypp. ( which I do not want to use here )