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

overlord/snapstate: avoid creating command aliases for daemons #3323

Merged
merged 3 commits into from
May 16, 2017

Conversation

pedronis
Copy link
Collaborator

We have plans to do something about daemons/services as well but for now avoid creating confusion, spurious symlinks.

…hing about daemon/services as well but later)
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Looks good, one question/suggestion inline for easier readability.

@@ -225,8 +230,8 @@ func refreshAliases(st *state.State, info *snap.Info, curAliases map[string]*Ali
if curTarget.Manual == "" {
continue
}
if info.Apps[curTarget.Manual] == nil {
// not an existing app
if !nonDaemon(info, curTarget.Manual) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to avoid the double negative here (!nonDaemon()). Maybe something like: if info.Apps[curTarget.Manual] != nil || isDaemon(info, curTarget.Manual) (slightly longer but I find it easier to read, but maybe thats just a personal preference).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was trying not too repeat .Apps all over the place but maybe readability is more important

Copy link
Contributor

@zyga zyga left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -201,6 +201,11 @@ func autoAliasesDelta(st *state.State, names []string) (changed map[string][]str
return changed, dropped, firstErr
}

func nonDaemon(info *snap.Info, appName string) bool {
app := info.Apps[appName]
return app != nil && app.Daemon == ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this place need changes when we land dbus-activated services?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

interesting question, I don't see changes to

https://github.com/snapcore/snapd/blob/master/wrappers/binaries.go#L37

in #2592

@mvo?

if we need to not have binaires for those maybe we can move to have a helper wrappers.HasBinary(app) , sounds like something to do in #2592 though

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mvo5 @zyga In case I'm adding wrappers.IsService(app) either way

Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

\o/

@pedronis pedronis merged commit 20a059c into canonical:master May 16, 2017
@pedronis pedronis deleted the no-command-aliases-to-daemons branch May 18, 2017 08:26
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