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

Add: nodes_selected_by_default option #11

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions rundeck/resource_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions rundeck/resource_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
),
Expand Down Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/job.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down