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

invalid JSON with nomad inspect <job> #3132

Closed
ygersie opened this issue Aug 30, 2017 · 2 comments · Fixed by #3139
Closed

invalid JSON with nomad inspect <job> #3132

ygersie opened this issue Aug 30, 2017 · 2 comments · Fixed by #3139
Labels
theme/api HTTP API and SDK issues type/bug

Comments

@ygersie
Copy link
Contributor

ygersie commented Aug 30, 2017

I use hashi-ui a lot and of it's awesome features is to up/down-scale taskgroups. This functionality however got broken with the 0.6 release if you don't have an update {} stanza specified in the job.

Reproduce:

job "example" {
  datacenters = ["zone1"]
  group "cache" {
    count = 1
    task "redis" {
      driver = "docker"
      config {
        image = "redis:3.2"
        port_map {
          db = 6379
        }
      }

      resources {
        cpu    = 500
        memory = 256
        network {
          mbits = 1
          port "db" {}
        }
      }

      service {
        name = "global-redis-check"
        tags = ["global", "cache"]
        port = "db"
        check {
          name     = "alive"
          type     = "tcp"
          interval = "10s"
          timeout  = "2s"
        }
      }
    }
  }
}

now nomad inspect example shows:

        "Update": {
            "AutoRevert": false,
            "Canary": 0,
            "HealthCheck": "",
            "HealthyDeadline": 0,
            "MaxParallel": 0,
            "MinHealthyTime": 0,
            "Stagger": 0
        }

Because hashiui fetches this from the API and re-posts the JSON job with an updated count I get the following validation errors from the API:

2017/08/30 11:24:34.306754 [ERR] http: Request /v1/jobs?region=ams1&wait=60000ms, error: 1 error(s) occurred:

* Task group cache validation failed: 1 error(s) occurred:

* 5 error(s) occurred:

* Invalid health check given: ""
* Max parallel can not be less than one: 0 < 1
* Healthy deadline must be greater than zero: 0s
* Minimum healthy time must be less than healthy deadline: 0s > 0s
* Stagger must be greater than zero: 0s

Issue also posted here jippi/hashi-ui#302

dadgar added a commit that referenced this issue Aug 30, 2017
This PR fixes an issue in which we would merge an update stanza from the
job into the task groups even if it was empty. This broke round
tripping a job (reading from the api and resubmitting as JSON)

Fixes #3132
@dadgar dadgar added theme/api HTTP API and SDK issues type/bug labels Aug 30, 2017
@ygersie
Copy link
Contributor Author

ygersie commented Aug 30, 2017

Thanks for the quick fix Alex!

@github-actions
Copy link

github-actions bot commented Dec 8, 2022

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme/api HTTP API and SDK issues type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants