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

sensu-agent --labels cmdline arg not working as expected #2357

Closed
jspaleta opened this issue Nov 16, 2018 · 6 comments
Closed

sensu-agent --labels cmdline arg not working as expected #2357

jspaleta opened this issue Nov 16, 2018 · 6 comments

Comments

@jspaleta
Copy link
Contributor

Expected Behavior

sensu-agent start --labels "hey=now" should populate entity metadata labels with "hey" key set to "now" value

Current Behavior

When --labels "hey=now" is used sensuctl entity info shows labels as null... even if labels are set in agent.yaml

Possible Solution

Steps to Reproduce (for bugs)

  1. config agent.yaml with labels defined
cat agent.yml
---
##
# agent configuration
##
subscriptions: "dev"
labels:
  pumpkin: spice 
  chia: latte
  1. start agent:
    sudo -u sensu sensu-agent start
  2. confirm labels are populated with sensuctl entity info --format yaml
type: Entity
spec:
  deregister: false
  deregistration: {}
  entity_class: agent
  last_seen: 1542327093
  metadata:
    annotations: null
    labels:
      chia: latte
      pumpkin: spice
    name: sensu-localdomain
    namespace: default
  1. start agent with --labels "hey=now"
    sudo -u sensu sensu-agent start --labels "hey=now"
  2. use sensuctl entity info --format yaml and see labels are null
type: Entity
spec:
  deregister: false
  deregistration: {}
  entity_class: agent
  last_seen: 1542327178
  metadata:
    annotations: null
    labels: null
    name: sensu-localdomain
    namespace: default

Your Environment

fedora 28
sensu-go beta8

@palourde
Copy link
Contributor

Related: spf13/viper#608

@ghost
Copy link

ghost commented Apr 4, 2019

I am also having this issue on MacOS, Kubernetes centos 7 docker image, and RHEL 7.

@ghost
Copy link

ghost commented Apr 8, 2019

It looks like viper is fixed, can someone update viper?
spf13/viper#200

@palourde
Copy link
Contributor

@maskeda While the issue we are having with the --labels & --annotations flags might have a similar underlying cause to spf13/viper#200, the problem appears to remain with Viper 1.3.2 because we are talking about two completely different functions, GetStringSlice vs GetStringMapString.

My understanding is that this problem still exists in Viper: spf13/viper#608

You mentioned in your PR that you were able to successfully test the --labels flag with Viper 1.3.2. Do you mind explaining how you did it?

Thanks!

@palourde
Copy link
Contributor

Also related: spf13/cobra#778

@palourde
Copy link
Contributor

palourde commented May 8, 2019

This is now fixed for good!

@palourde palourde closed this as completed May 8, 2019
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

No branches or pull requests

2 participants