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

Service without labels returns null, not {} #24631

Closed
thaJeztah opened this issue Jul 14, 2016 · 5 comments · Fixed by #30967
Closed

Service without labels returns null, not {} #24631

thaJeztah opened this issue Jul 14, 2016 · 5 comments · Fixed by #30967
Labels
area/swarm kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. priority/P3 Best effort: those are nice to have / minor issues.

Comments

@thaJeztah
Copy link
Member

if no labels are set on a service, Spec.Labels is null, not an empty map/object;

$ docker service create --name nolabels nginx:alpine
$ docker service inspect --format '{{ json .Spec.Labels}}' nolabels
null

This is inconsistent with containers, where it's always a map/object;

$ docker run --name nolabels busybox sh
$ docker inspect --format '{{json .Config.Labels }}' nolabels
{}

I think we should fix that, to keep consistency in our UX.

@thaJeztah thaJeztah added kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. area/swarm labels Jul 14, 2016
@thaJeztah thaJeztah added this to the 1.12.0 milestone Jul 14, 2016
@thaJeztah thaJeztah added priority/P2 Normal priority: default priority applied. priority/P3 Best effort: those are nice to have / minor issues. and removed priority/P2 Normal priority: default priority applied. labels Jul 14, 2016
@thaJeztah
Copy link
Member Author

/cc @tiborvass

@vdemeester
Copy link
Member

Agreeing on the inconsistency, I'll take a look.
#dibs 👼

@thaJeztah
Copy link
Member Author

@vdemeester Thanks! I didn't check other properties (env-vars, etc), so those may need a change as well. Also didn't compare the API between "containers" and "services"

@thaJeztah thaJeztah removed this from the 1.12.0 milestone Jul 28, 2016
@thaJeztah
Copy link
Member Author

ping @vdemeester just found this one, did we ever change this?

@vdemeester vdemeester removed their assignment Feb 1, 2017
@adshmh
Copy link
Contributor

adshmh commented Feb 10, 2017

#dibs

A few other types also behave the same way, e.g.:

$ docker node inspect --format '{{ json .Spec.Labels}}' self
null

adshmh added a commit to adshmh/docker that referenced this issue Feb 15, 2017
…s is empty object {}

Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
LK4D4 added a commit that referenced this issue Feb 17, 2017
…turns-empty-map

Inspect output on service without labels is an empty map instead of null, fixes #24631
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/swarm kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. priority/P3 Best effort: those are nice to have / minor issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants