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

Unable to submit a Nomad-produced JSON job #1163

Closed
multani opened this issue May 10, 2016 · 4 comments
Closed

Unable to submit a Nomad-produced JSON job #1163

multani opened this issue May 10, 2016 · 4 comments

Comments

@multani
Copy link
Contributor

multani commented May 10, 2016

Nomad version

$ nomad version
Nomad v0.3.2

Operating system and Environment details

Running Nomad from Vagrant using https://raw.githubusercontent.com/hashicorp/nomad/master/demo/vagrant/Vagrantfile

Issue

The JSON file produced by nomad run -output job.nomad can't be feed back to Nomad.

Reproduction steps

I'm trying to run the following (simplest job definition I was able to make?):

vagrant@nomad:~$ cat hello.nomad
job "hello-world-service" {
    datacenters = ["dc1"]

    group "hello" {
        task "hello" {
            driver = "docker"
            config { image = "hello-world" }
            resources {}
        }
    }
}
vagrant@nomad:~$ nomad validate hello.nomad
Job validation successful

vagrant@nomad:~$ nomad run -output hello.nomad > hello.nomad.json
vagrant@nomad:~$ nomad validate hello.nomad.json
Error parsing job file hello.nomad.json: 1 error(s) occurred:

* invalid key: Job


vagrant@nomad:~$ nomad run hello.nomad
==> Monitoring evaluation "a048e608"
    Evaluation triggered by job "hello-world-service"
    Allocation "07d4fef5" modified: node "7f918375", group "hello"
    Evaluation status changed: "pending" -> "complete"
==> Evaluation "a048e608" finished with status "complete"

vagrant@nomad:~$ nomad run hello.nomad.json
Error parsing job file hello.nomad.json: 1 error(s) occurred:

* invalid key: Job

Job file

job "hello-world-service" {
    datacenters = ["dc1"]

    group "hello" {
        task "hello" {
            driver = "docker"
            config { image = "hello-world" }
            resources {}
        }
    }
}
@multani
Copy link
Contributor Author

multani commented May 10, 2016

However, passing the JSON job directly via the HTTP API works correctly, so I guess it's only a validation problem while reading the job definition.

@dadgar
Copy link
Contributor

dadgar commented May 10, 2016

Hey,

nomad validate and nomad run only operate on HCL jobs and not JSON jobs. Will update the documentation.

Thanks,
Alex

@dadgar dadgar closed this as completed May 10, 2016
@multani
Copy link
Contributor Author

multani commented May 10, 2016

Oh well, I had some doubts about it, but the documentation and the error message aren't very clear about it.

@github-actions
Copy link

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 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants