Skip to content

Commit

Permalink
Fixed documentation and test
Browse files Browse the repository at this point in the history
  • Loading branch information
markotting committed Sep 25, 2024
1 parent ee9d02c commit e3467f1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
24 changes: 18 additions & 6 deletions rundeck/resource_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,25 @@ func TestAccJob_cmd_nodefilter(t *testing.T) {
{
Config: testAccJobConfig_cmd_nodefilter,
Check: resource.ComposeTestCheckFunc(
testAccJobCheckExists("rundeck_job.test", &job),
testAccJobCheckExists("rundeck_job.source_test_job", &job),
func(s *terraform.State) error {
if expected := "basic-job-with-node-filter"; job.Name != expected {
return fmt.Errorf("wrong name; expected %v, got %v", expected, job.Name)
if job.CommandSequence.Commands[0].Job.FailOnDisable != true {
return fmt.Errorf("FailOnDisable should be enabled")
}
if expected := "name: tacobell"; job.CommandSequence.Commands[0].Job.NodeFilter.Query != expected {
return fmt.Errorf("failed to set job node filter; expected %v, got %v", expected, job.CommandSequence.Commands[0].Job.NodeFilter.Query)
if job.CommandSequence.Commands[0].Job.ChildNodes != true {
return fmt.Errorf("ChildNodes should be enabled")
}
if job.CommandSequence.Commands[0].Job.IgnoreNotifications != true {
return fmt.Errorf("IgnoreNotifications should be enabled")
}
if job.CommandSequence.Commands[0].Job.ImportOptions != true {
return fmt.Errorf("ImportOptions should be enabled")
}
if expected := "source_test_job"; job.CommandSequence.Commands[0].Job.Name != expected {
return fmt.Errorf("wrong referenced job name; expected %v, got %v", expected, job.CommandSequence.Commands[0].Job.Name)
}
if expected := "source_project"; job.CommandSequence.Commands[0].Job.Project != expected {
return fmt.Errorf("wrong referenced project name; expected %v, got %v", expected, job.CommandSequence.Commands[0].Job.Project)
}
return nil
},
Expand Down Expand Up @@ -490,7 +502,7 @@ resource "rundeck_job" "target_test_job" {
command {
job {
name = "${rundeck_job.source_test_job.name}"
group_name = "${rundeck_project.target_test.name}"
project_name = "${rundeck_project.target_test.name}"
run_for_each_node = true
child_nodes = true
fail_on_disable = true
Expand Down
8 changes: 8 additions & 0 deletions website/docs/r/job.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,14 @@ A command's `job` block has the following structure:
* `args`: (Optional) A string giving the arguments to pass to the target job, using
[Rundeck's job arguments syntax](http://rundeck.org/docs/manual/jobs.html#job-reference-step).

* `import_options`: (Optional) Pass as argument any options that match the referenced job's options.

* `skip_notifications` (Optional) If the referenced job has notifications, they will be skipped.

* `fail_on_disable` (Optional) If the referenced job has disabled execution, it will be considered a failure

* `child_nodes`: (Optional) If the referenced job is from another project, you can use referenced job node list instead of the parent's nodes.

* `node_filters`: (Optional) A map for overriding the referenced job's node filters.

A command's `node_filters` block has the following structure:
Expand Down

0 comments on commit e3467f1

Please sign in to comment.