From a769032c4b2c1d6020c263a5356b85abd1031c3f Mon Sep 17 00:00:00 2001 From: Adam Brett Date: Fri, 20 Oct 2017 16:30:31 +0100 Subject: [PATCH] Add: nodes_selected_by_default option --- rundeck/resource_job.go | 7 +++++++ rundeck/resource_job_test.go | 5 +++++ website/docs/r/job.html.md | 3 +++ 3 files changed, 15 insertions(+) diff --git a/rundeck/resource_job.go b/rundeck/resource_job.go index 7fecbcf417..d29be537ef 100644 --- a/rundeck/resource_job.go +++ b/rundeck/resource_job.go @@ -100,6 +100,11 @@ func resourceRundeckJob() *schema.Resource { Optional: true, }, + "nodes_selected_by_default": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + }, + "schedule": &schema.Schema{ Type: schema.TypeString, Optional: true, @@ -356,6 +361,7 @@ func jobFromResourceData(d *schema.ResourceData) (*rundeck.JobDetail, error) { RankAttribute: d.Get("rank_attribute").(string), RankOrder: d.Get("rank_order").(string), }, + NodesSelectedByDefault: d.Get("nodes_selected_by_default").(bool), } sequence := &rundeck.JobCommandSequence{ @@ -528,6 +534,7 @@ func jobToResourceData(job *rundeck.JobDetail, d *schema.ResourceData) error { d.Set("node_filter_query", job.NodeFilter.Query) d.Set("node_filter_exclude_precedence", job.NodeFilter.ExcludePrecedence) } + d.Set("nodes_selected_by_default", job.NodesSelectedByDefault) optionConfigsI := []interface{}{} if job.OptionsConfig != nil { diff --git a/rundeck/resource_job_test.go b/rundeck/resource_job_test.go index 2bcf6f0e16..faea54bc3e 100644 --- a/rundeck/resource_job_test.go +++ b/rundeck/resource_job_test.go @@ -28,6 +28,10 @@ func TestAccJob_basic(t *testing.T) { if expected := "Prints Hello World"; job.CommandSequence.Commands[0].Description != expected { return fmt.Errorf("failed to set command description; expected %v, got %v", expected, job.CommandSequence.Commands[0].Description) } + if expected := true; job.NodesSelectedByDefault != expected { + return fmt.Errorf("failed to set node selected by default; expected %v, got %v", expected, job.NodesSelectedByDefault) + } + return nil }, ), @@ -91,6 +95,7 @@ resource "rundeck_job" "test" { name = "basic-job" description = "A basic job" node_filter_query = "example" + nodes_selected_by_default = true allow_concurrent_executions = 1 max_thread_count = 1 rank_order = "ascending" diff --git a/website/docs/r/job.html.md b/website/docs/r/job.html.md index 95ca212e63..892f74e4e0 100644 --- a/website/docs/r/job.html.md +++ b/website/docs/r/job.html.md @@ -79,6 +79,9 @@ The following arguments are supported: * `node_filter_exclude_precedence`: (Optional) Boolean controlling a deprecated Rundeck feature that controls whether node exclusions take priority over inclusions. + +* `nodes_selected_by_default`: (Optional) Boolean controlling whether nodes that match the node_query_filter are + selected by default or not * `option`: (Optional) Nested block defining an option a user may set when executing this job. A job may have any number of options. The structure of this nested block is described below.