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

param dependency fails in samples/shellContext.hcl #313

Closed
rebeccaskinner opened this issue Sep 26, 2016 · 0 comments · Fixed by #315
Closed

param dependency fails in samples/shellContext.hcl #313

rebeccaskinner opened this issue Sep 26, 2016 · 0 comments · Fixed by #315
Assignees
Labels
Milestone

Comments

@rebeccaskinner
Copy link
Contributor

There is a race condition in samples/shellContext.hcl (see [1] below) caused by the fact that an edge is not being created between task.touch-file and param.var-name (see [2] below).

This is likely because dependency generation fails when lookups are present in the keys of embedded maps.

[1] shellContext.hcl

/* These tasks demonstrate the use of 'env' and 'dir' for the shell module. It
also demonstrates how the working directory and environment variables can be
populated from params. */

param "working-directory" {
  default = "/tmp/converge-working"
}

param "test-file" {
  default = "test-file"
}

param "var-name" {
  default = "ROLE"
}

param "listen-address" {
  default = ":4001"
}

task "directory" {
  check = "test -d {{param `working-directory`}}"
  apply = "mkdir -p {{param `working-directory`}}"
}

task "touch-file" {
  interpreter = "/bin/bash"
  check_flags = ["-n"]
  dir         = "{{param `working-directory`}}"

  env {
    "{{param `var-name`}}" = "test"
    "ADDRESS"              = "{{param `listen-address`}}"
  }

  check = "cat {{param `test-file`}} | grep \"test: :4001\""
  apply = "echo $ROLE: $ADDRESS > test-file"

  depends = ["task.directory"]
}

[2] graph output

digraph {

subgraph cluster_0 {
"root" [ label="Module: /" ];
"root/param.test-file" [ label="param.test-file: test-file" ];
"root/param.listen-address" [ label="param.listen-address: :4001" ];
"root/param.working-directory" [ label="param.working-directory: /tmp/converge-working" ];
"root/task.directory" [ label="task.directory" , shape="component" ];
"root/param.var-name" [ label="param.var-name: ROLE" ];
"root/task.touch-file" [ label="task.touch-file" , shape="component" ];
}
"root/task.touch-file" -> "root/param.listen-address" [ label="" ];
"root" -> "root/param.test-file" [ label="" ];
"root/task.touch-file" -> "root/param.test-file" [ label="" ];
"root" -> "root/param.listen-address" [ label="" ];
"root" -> "root/param.working-directory" [ label="" ];
"root" -> "root/param.var-name" [ label="" ];
"root/task.touch-file" -> "root/param.working-directory" [ label="" ];
"root/task.directory" -> "root/param.working-directory" [ label="" ];
"root/task.touch-file" -> "root/task.directory" [ label="" ];
"root" -> "root/task.touch-file" [ label="" ];
"root" -> "root/task.directory" [ label="" ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant