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

D-Bus API for registration #791

Merged
merged 68 commits into from
Oct 24, 2023
Merged

Conversation

joseivanlopez
Copy link
Contributor

@joseivanlopez joseivanlopez commented Oct 4, 2023

Problem

Agama needs to know the repositories of the product to install. But for some products (e.g., SLE, ALP), the repositories are unknown until the product is registered.

Solution

Export a new D-Bus object /org/opensuse/Agama/Software1/Product to manage the product selection and registration. Note that methods for selecting a product were moved from /org/opensuse/Agama/Software1 object.

# busctl --address unix:path=/run/agama/bus introspect org.opensuse.Agama.Software1 /org/opensuse/Agama/Software1/Product
NAME                                 TYPE      SIGNATURE  RESULT/VALUE                             FLAGS
org.opensuse.Agama.Software1.Product interface -          -                                        -
.SelectProduct                       method    s          (us)                                     -
.AvailableProducts                   property  a(ssa{sv}) 3 "ALP-Dolomite" "SUSE ALP Dolomite" 1 … emits-change
.SelectedProduct                     property  s          "Tumbleweed"                             emits-change
org.opensuse.Agama1.Issues           interface -          -                                        -
.All                                 property  a(ssuu)    0                                        emits-change
org.opensuse.Agama1.Registration     interface -          -                                        -
.Deregister                          method    -          (us)                                     -
.Register                            method    sa{sv}     (us)                                     -
.Email                               property  s          ""                                       emits-change
.RegCode                             property  s          ""                                       emits-change
.Requirement                         property  u          0                                        emits-change

Note 1: the current code still uses the libsuseconnect ruby bindings to communicate to SCC. That bindings only exist because of YaST, and it should not be used for new projects. The plan is to directly use SUSEConnect CLI in Agama instead. But for that, SUSEConnect needs some improvements in order to avoid applying changes on the running system. SCC team is already working on it, see https://github.com/SUSE/scc-docs/pull/287.

Note 2: the current implementation works similar to YaST, that is, the service, repositories, SCC credentials, etc are directly added to the running system (e.g., TW running on agama-live) and then they are copied to the target system. Changes altering the running system should be avoided. This will be improved in a follow-up task, see https://trello.com/c/jqcFar3M/243-agama-registration-avoid-changes-in-running-system.

Note 3: RMT and SSL certificates are not covered yet. This will come in a next iteration.

Note 4: the target of this PR is the registration feature branch. It will be merged into master once the registration UI is implemented.

Note 5: changelog will be added later at the time of merging into master.

Testing

  • Added unit tests
  • Tested manually

@coveralls
Copy link

coveralls commented Oct 4, 2023

Coverage Status

coverage: 75.536% (+0.4%) from 75.13% when pulling aa32a97 on registration-dbus-api into 18d7a88 on registration.

# selected patterns is hash with pattern name as id and 0 for user selected and
# 1 for auto selected. Can be extended in future e.g. for mandatory patterns
dbus_attr_reader :selected_patterns, "a{sy}"
dbus_reader :selected_product, "s"
Copy link
Contributor

Choose a reason for hiding this comment

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

when we touch it we probably also need to solve issue with version...as there can be two products with same name and different version like it happen with micro based on some SP. And registration need version....maybe product should be tuple of strings with name and version?

@joseivanlopez joseivanlopez changed the base branch from master to registration October 23, 2023 11:04
@joseivanlopez joseivanlopez marked this pull request as ready for review October 23, 2023 14:04
Copy link
Contributor

@jreidinger jreidinger left a comment

Choose a reason for hiding this comment

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

LGTM now. manual test passed

@joseivanlopez joseivanlopez merged commit 5f6fc37 into registration Oct 24, 2023
14 checks passed
@joseivanlopez joseivanlopez deleted the registration-dbus-api branch October 24, 2023 09:02
@joseivanlopez joseivanlopez mentioned this pull request Oct 24, 2023
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.

5 participants