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

Node is sometimes unresolvable, depending on ordering within a template #254

Closed
rebeccaskinner opened this issue Sep 14, 2016 · 4 comments
Closed
Assignees
Labels
Milestone

Comments

@rebeccaskinner
Copy link
Contributor

This is broken...

task.query "should-install-go" {
  interpreter = "/bin/bash"
  query = "[[ '{{param `goversion`}}' == '{{lookup `task.query.go-installed-version.checkstatus.stdout`}}']]"
}

but this isnt...

task.query "should-install-go" {
  interpreter = "/bin/bash"
  query = "[[ '{{lookup `task.query.go-installed-version.checkstatus.stdout`}}' == '{{param `goversion`}}' ]]"
}

in

task.query "lookup-gopath" {
  interpreter = "/bin/bash"
  query = " if [[ -z $GOPATH ]]; then echo -n '{{param `defaultGopath`}}'; else echo -n ${GOPATH}; fi "
}

task.query "go-installed-version" {
  interpreter = "/bin/bash"
  query = "go version | awk '{print $3}'"
}

param "goversion" {
  default = "1.7.1"
}

task.query "should-install-go" {
  interpreter = "/bin/bash"
  query = "[[ '{{lookup `task.query.go-installed-version.checkstatus.stdout`}}' == '{{param `goversion`}}' ]]"
}

param "defaultGopath" {
  default = "${HOME}/go"
}

param "gopath" {
  default = "{{lookup `task.query.lookup-gopath.status.stdout`}}"
}

param "platform" {
  default = "darwin-amd64"
}

param "gopkg" {
  default = "https://storage.googleapis.com/golang/{{param `packagename`}}"
}

param "packagename" {
  default = "go{{param `goversion`}}.{{param `platform`}}.pkg"
}

task.query "tempdir" {
  interpreter = "/bin/bash"
  query = "echo -n $(mktemp -d)"
}

param "downloadpath" {
  default = "{{lookup `task.query.tempdir.Status.Stdout`}}/{{param `packagename`}}"
}

task "download go" {
  interpreter = "/bin/bash"
  check = "[[ 1 == {{lookup `task.query.should-install-go.status.exitstatus`}} && -f {{param `downloadpath`}} ]]"
  apply = "curl {{param `gopkg`}} > {{param `downloadpath`}}"
}
@BrianHicks
Copy link
Contributor

what's the error?

@rebeccaskinner rebeccaskinner self-assigned this Sep 19, 2016
@rebeccaskinner
Copy link
Contributor Author

Minimal reproduction:

param "bar" {
  default = "bar"
}
task.query "foo" {
  query = "echo foo"
}
task.query "should-install-go" {
  interpreter = "/bin/bash"
  query = "[[ '{{param `bar`}}' == '{{lookup `task.query.foo.checkstatus.stdout`}}']]"

  ## works this way
  # query = "[['{{lookup `task.query.foo.checkstatus.stdout`}}' ==  '{{param `bar`}}']]"
}

Output:

timestamp="2016-09-19T08:06:47-05:00" level="WARN" msg="setting session-local token" token="91dc0074-bdfa-43b0-b0aa-bef4636378ff"
timestamp="2016-09-19T08:06:47-05:00" level="INFO" msg="serving" addr=":47740" component="rpc"
timestamp="2016-09-19T08:06:47-05:00" level="WARN" msg="skipping module verfiction" component="client"
timestamp="2016-09-19T08:06:47-05:00" level="INFO" msg="planning" component="client" file="bad.hcl"
timestamp="2016-09-19T08:06:47-05:00" level="INFO" msg="resolving dependencies" component="rpc" function="ResolveDependencies" runID="b3d10f39-ddb7-4bee-891b-c894f51be966"
timestamp="2016-09-19T08:06:47-05:00" level="INFO" msg="loading resources" component="rpc" function="SetResources" runID="b3d10f39-ddb7-4bee-891b-c894f51be966"
timestamp="2016-09-19T08:06:47-05:00" level="INFO" msg="no check_flags specified for interpeter, skipping syntax validation" 
timestamp="2016-09-19T08:06:47-05:00" level="INFO" msg="got status" component="client" file="bad.hcl" id="root/param.bar" run="STARTED" stage="PLAN"
timestamp="2016-09-19T08:06:47-05:00" level="INFO" msg="got status" component="client" file="bad.hcl" id="root/task.query.foo" run="STARTED" stage="PLAN"
timestamp="2016-09-19T08:06:47-05:00" level="INFO" msg="got status" component="client" file="bad.hcl" id="root/task.query.should-install-go" run="STARTED" stage="PLAN"
pipeline returned Right node is unresolvable
timestamp="2016-09-19T08:06:47-05:00" level="ERROR" msg="planning failed" component="rpc" error="1 error(s) occurred:\n\n* root/task.query.should-install-go: node is unresolvable" function="executor.Plan" location="bad.hcl" runID="b3d10f39-ddb7-4bee-891b-c894f51be966"
timestamp="2016-09-19T08:06:47-05:00" level="FATAL" msg="could not get responses" component="client" error="error getting status response: rpc error: code = 2 desc = planning bad.hcl: 1 error(s) occurred:\n\n* root/task.query.should-install-go: node is unresolvable" file="bad.hcl"

rebeccaskinner pushed a commit that referenced this issue Sep 19, 2016
unimplemented calls result in early template execution termination.

Fixes issue #254
@BrianHicks BrianHicks added this to the 0.2.0-beta2 milestone Sep 19, 2016
rebeccaskinner pushed a commit that referenced this issue Sep 20, 2016
unimplemented calls result in early template execution termination.

Fixes issue #254
rebeccaskinner pushed a commit that referenced this issue Sep 20, 2016
unimplemented calls result in early template execution termination.

Fixes issue #254
@rebeccaskinner
Copy link
Contributor Author

Fixed in #265

@rebeccaskinner
Copy link
Contributor Author

Fixed in #288

BrianHicks pushed a commit that referenced this issue Dec 22, 2016
unimplemented calls result in early template execution termination.

Fixes issue #254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants