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

feat: add client-id subcommand to yggctl #259

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DuckBoss
Copy link
Contributor

This patch adds a 'client-id' subcommand
to yggctl which retrieves and prints to stdout
the active client ID of a yggd instance.

This attempts to resolve issue #243

Copy link
Contributor

@jirihnidek jirihnidek left a comment

Choose a reason for hiding this comment

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

I can confirm that it works, but I would improve error messages. Some functions do not have doc strings.

@@ -173,6 +173,23 @@ func messageJournalAction(ctx *cli.Context) error {
return nil
}

func clientIDAction(ctx *cli.Context) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Doc string for this function is missing

obj := conn.Object("com.redhat.Yggdrasil1", "/com/redhat/Yggdrasil1")
var clientID string
if err := obj.Call("com.redhat.Yggdrasil1.GetClientID", dbus.Flags(0)).Store(&clientID); err != nil {
return cli.Exit(fmt.Errorf("cannot retrieve client id: %v", err), 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add more information to this error message. E.g. what object was called. Otherwise you get this error message:

user@localhost:~/path/to/yggdrasil$ go run ./cmd/yggctl client-id
cannot retrieve client id: The name is not activatable
exit status 1

@jirihnidek
Copy link
Contributor

go-lines also reports some issue. Some formatting probably needs to be improved.

@DuckBoss
Copy link
Contributor Author

Thanks for the initial review @jirihnidek .
I was trying to get some feedback on the way this was implemented, but since that part looks okay to you I can go ahead and resolve the issues you've brought up, thanks 👍

@DuckBoss DuckBoss force-pushed the jajerome/client-id-subcmd branch from 9f973ed to 876aa11 Compare September 10, 2024 14:32
@DuckBoss DuckBoss marked this pull request as ready for review September 10, 2024 15:01

Returns the current client id on the interface.
-->
<method name="GetClientID">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you try defining this as a D-Bus object property rather than a "getter" method?

@DuckBoss DuckBoss force-pushed the jajerome/client-id-subcmd branch from 876aa11 to 90b7818 Compare November 11, 2024 13:20
This patch adds a 'client-id' subcommand
to yggctl which retrieves and prints to stdout
the active client ID of a yggd instance.

This attempts to resolve issue RedHatInsights#243

Signed-off-by: Jason Jerome <[email protected]>
@DuckBoss DuckBoss force-pushed the jajerome/client-id-subcmd branch from 90b7818 to 9a45f83 Compare November 11, 2024 13:21
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.

3 participants