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

Nomad encodes ampersand as unicode in job-spec #2314

Closed
michaelmcguinness opened this issue Feb 14, 2017 · 2 comments
Closed

Nomad encodes ampersand as unicode in job-spec #2314

michaelmcguinness opened this issue Feb 14, 2017 · 2 comments
Labels

Comments

@michaelmcguinness
Copy link

Nomad version

Nomad v0.5.4

Operating system and Environment details

Ubuntu 14-04
3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015

Issue

We have a use case where a Nomad job is a Consul watch and the handler is another Nomad job. The URL passed to nomad run requires both the raw and token parameters passed in the format ?raw&token=<uuid>. Once passed to Nomad a nomad inspect shows that the ampersand has been encoded as \u0026. This encoding is not valid for the 'inner' Nomad job.

This example is Consul watch running in Nomad managing a Nomad job this issue is generic wherever \u0026 is not valid.

Job file

job "nomad-ui-watch" {
  region = "eu-west-1"
  datacenters = ["vpc-poc"]
  type = "service"
  priority = 10

  group "nomad-ui-watch-group" {
    count = 1
    task "nomad-ui-watch-task" {
      driver = "exec"
      config {
        command = "/usr/local/bin/consul"
        args = [
          "watch",
          "-type=key",
          "-key=peadmin/nomad/jobs/system/poc/nomad-ui",
          "/usr/local/bin/nomad",
          "run",
          "http://localhost:8500/v1/kv/peadmin/nomad/jobs/system/poc/nomad-ui?raw&token=51cf9dca-56fd-470c-b973-d48c10748ab5"]
      }

     logs {
	     max_files = 2
	     max_file_size = 1
      }
      resources {
        cpu = 20
        memory = 10
      }
    }
  }
}

Snippet of resulting JSON as shownby nomad inspect

                        "Config": {
                            "args": [
                                "watch",
                                "-type=key",
                                "-key=peadmin/nomad/jobs/system/poc/nomad-ui",
                                "/usr/local/bin/nomad",
                                "run",
                                "http://localhost:8500/v1/kv/peadmin/nomad/jobs/system/poc/nomad-ui?raw\u0026token=51cf9dca-56fd-470c-b973-d48c10748ab5"
                            ],
                            "command": "/usr/local/bin/consul"
                        },
@dadgar dadgar added theme/api HTTP API and SDK issues stage/needs-investigation labels Feb 14, 2017
@dadgar
Copy link
Contributor

dadgar commented Feb 14, 2017

Cross linking: ugorji/go#189

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

No branches or pull requests

2 participants