From e3467f1143998570c1b1b2df55e67a76353f1cfd Mon Sep 17 00:00:00 2001 From: "mark_gh@malkav.dds.nl" Date: Wed, 25 Sep 2024 18:21:31 +0200 Subject: [PATCH] Fixed documentation and test --- rundeck/resource_job_test.go | 24 ++++++++++++++++++------ website/docs/r/job.html.md | 8 ++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/rundeck/resource_job_test.go b/rundeck/resource_job_test.go index 01f112e02..8fbd93606 100644 --- a/rundeck/resource_job_test.go +++ b/rundeck/resource_job_test.go @@ -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 }, @@ -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 diff --git a/website/docs/r/job.html.md b/website/docs/r/job.html.md index 1d4a90bf0..7934fd9c2 100644 --- a/website/docs/r/job.html.md +++ b/website/docs/r/job.html.md @@ -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: