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

cmd/silence: Can't set empty tags #1650

Closed
kylebrandt opened this issue Mar 5, 2016 · 0 comments · Fixed by #1860
Closed

cmd/silence: Can't set empty tags #1650

kylebrandt opened this issue Mar 5, 2016 · 0 comments · Fixed by #1860

Comments

@kylebrandt
Copy link
Member

Due to:

https:/bosun-monitor/bosun/blob/master/cmd/silence/main.go#L40

if *flagTags == "" {
        *flagTags = "host=" + util.Hostname
    }

I fixed this problem while in annoate cli by doing the following:

    setHostname := false
    for _, arg := range os.Args {
        if arg == "-"+flagHostFlagKey {
            setHostname = true
        }
    }

Kind of a bit crude, but works. I should check in flag and see if there is a better way to do this.

Also, while in code I should make it so it doesn't take os/user since that uses Cgo. Did the following in annotate and it seems to work fine:

    un := *userFlag
    if un == "" {
        // Since os/user requires cgo
        un = os.Getenv(USER_ENV)
        sudo := os.Getenv("SUDO_USER")
        if sudo != "" {
            un = sudo
        }
    }
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 a pull request may close this issue.

1 participant