Skip to content

Commit

Permalink
ReImplement PR #11
Browse files Browse the repository at this point in the history
PR #11 source was removed.  This should implement the same functionality but getting a build error.
  • Loading branch information
fdevans committed Jul 27, 2021
1 parent d69ddbe commit 918d799
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rundeck/resource_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ func resourceRundeckJob() *schema.Resource {
Default: true,
},

"nodes_selected_by_default": {
Type: schema.TypeBool,
Optional: true,
},

"time_zone": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -592,6 +597,7 @@ func jobFromResourceData(d *schema.ResourceData) (*JobDetail, error) {
ExecutionEnabled: d.Get("execution_enabled").(bool),
Timeout: d.Get("timeout").(string),
ScheduleEnabled: d.Get("schedule_enabled").(bool),
NodesSelectedByDefault: d.Get("nodes_selected_by_default").(bool),
TimeZone: d.Get("time_zone").(string),
LogLevel: d.Get("log_level").(string),
AllowConcurrentExecutions: d.Get("allow_concurrent_executions").(bool),
Expand Down Expand Up @@ -808,6 +814,9 @@ func jobToResourceData(job *JobDetail, d *schema.ResourceData) error {
if err := d.Set("schedule_enabled", job.ScheduleEnabled); err != nil {
return err
}
if err := d.Set("nodes_selected_by_default", job.NodesSelectedByDefault); err != nil {
return err
}
if err := d.Set("time_zone", job.TimeZone); err != nil {
return err
}
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 @@ -29,6 +29,9 @@ 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)
}
if job.Dispatch.SuccessOnEmptyNodeFilter != true {
return fmt.Errorf("failed to set success_on_empty_node_filter; expected true, got %v", job.Dispatch.SuccessOnEmptyNodeFilter)
}
Expand Down Expand Up @@ -188,6 +191,7 @@ resource "rundeck_job" "test" {
execution_enabled = true
node_filter_query = "example"
allow_concurrent_executions = true
nodes_selected_by_default = true
success_on_empty_node_filter = true
max_thread_count = 1
rank_order = "ascending"
Expand Down Expand Up @@ -231,6 +235,7 @@ resource "rundeck_job" "test" {
execution_enabled = true
node_filter_query = "example"
allow_concurrent_executions = true
nodes_selected_by_default = false
max_thread_count = 1
rank_order = "ascending"
schedule = "0 0 12 * * * *"
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 @@ -114,6 +114,9 @@ The following arguments are supported:
* `node_filter_exclude_precedence`: (Optional, Deprecated) 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

0 comments on commit 918d799

Please sign in to comment.