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

plan's diff output does not sort arrays numerically #4421

Open
dekimsey opened this issue Jun 15, 2018 · 3 comments
Open

plan's diff output does not sort arrays numerically #4421

dekimsey opened this issue Jun 15, 2018 · 3 comments

Comments

@dekimsey
Copy link
Collaborator

Nomad version

Nomad v0.8.3 (c85483da3471f4bd3a7c3de112e95f551071769f)

Operating system and Environment details

OS X, though likely n/a

Issue

The plan diff output lists the args[] changes, but is not sorted numerically. As a user, I'd expect an array to be sorted numerically by index.

+/- Task Group: "fabio" (2 create)
  +/- Task: "lb" (forces create/destroy update)
    +/- Config {
          args[0]:                                     "/fabio"
      +/- args[10]:                                    "-proxy.addr" => ":50560;proto=tcp"
      +/- args[11]:                                    ":9021;proto=tcp" => "-proxy.addr"
      +/- args[12]:                                    "-proxy.addr" => ":9021;proto=tcp"
      +/- args[13]:                                    ":49300;proto=tcp" => "-proxy.addr"
      +/- args[14]:                                    "-proxy.addr" => ":49300;proto=tcp"
      +/- args[15]:                                    ":50850;proto=tcp" => "-proxy.addr"
      +/- args[16]:                                    "-proxy.addr" => ":50850;proto=tcp"
      +/- args[17]:                                    ":52240;proto=tcp" => "-proxy.addr"
      +/- args[18]:                                    "-proxy.addr" => ":52240;proto=tcp"
      +/- args[19]:                                    ":50360;proto=tcp" => "-proxy.addr"
          args[1]:                                     "-registry.consul.addr=consul:8500"
      +/- args[20]:                                    "-proxy.addr" => ":50360;proto=tcp"
      +/- args[21]:                                    ":50880;proto=tcp" => "-proxy.addr"
      +/- args[22]:                                    "-proxy.addr" => ":50880;proto=tcp"
      +/- args[23]:                                    ":52760;proto=tcp" => "-proxy.addr"
      +/- args[24]:                                    "-proxy.addr" => ":52760;proto=tcp"
      +/- args[25]:                                    ":9010;proto=tcp" => "-proxy.addr"
      +/- args[26]:                                    "-proxy.addr" => ":9010;proto=tcp"
      +/- args[27]:                                    ":50110;proto=tcp" => "-proxy.addr"
      +/- args[28]:                                    "-proxy.addr" => ":50110;proto=tcp"
      +/- args[29]:                                    ":52100;proto=tcp" => "-proxy.addr"
          args[2]:                                     "-registry.consul.register.enabled=false"
      +/- args[30]:                                    "-proxy.addr" => ":52100;proto=tcp"
      +/- args[31]:                                    ":52810;proto=tcp" => "-proxy.addr"
      +/- args[32]:                                    "-proxy.addr" => ":52810;proto=tcp"
      +/- args[33]:                                    ":52410;proto=tcp" => "-proxy.addr"
      +/- args[34]:                                    "-proxy.addr" => ":52410;proto=tcp"

Reproduction steps

Change Task arguments in a arg list that exceeds 10 arguments.

@schmichael
Copy link
Member

Confirmed and can be reproduced by running nomad plan -verbose foo.nomad on any job file with 10 or more args:

job "echo" {
  type = "batch"
  datacenters = ["dc1"]
  group "echo" {
    task "echo" {
      driver = "raw_exec"

      config {
        command = "/bin/sh"
        args    = ["-c", "echo x", "", "", "", "", "", "", "", "", "", ""]
      }
    }
  }
}

Output snippet:

+ Config {
      + args[0]:  "-c"
        args[10]: ""
        args[11]: ""

@dekimsey
Copy link
Collaborator Author

Thank you for providing a test case @schmichael. I was feeling pretty lazy at the time and didn't want to figure out how to make a minimal job spec. 😦

@schmichael
Copy link
Member

No worries @dekimsey -- your report was great! As a tip though nomad init -short is a great way to get a smaller sample job file without the tons of comments of the standard nomad init output. #4239

@tgross tgross added this to Needs Roadmapping in Nomad - Community Issues Triage Feb 12, 2021
@tgross tgross removed this from Needs Roadmapping in Nomad - Community Issues Triage Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants