From 5d1e6495810d3b6f851a1fa8fb85eee281c69aab Mon Sep 17 00:00:00 2001 From: Gerben Jacobs Date: Wed, 10 May 2017 14:09:15 +0200 Subject: [PATCH 1/3] adds `description` to `command` schema in `rundeck_job` resource Change-Id: I90e729dd6864b79773c80aedb39991eb251ab821 --- builtin/providers/rundeck/resource_job.go | 6 ++++++ builtin/providers/rundeck/resource_job_test.go | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/builtin/providers/rundeck/resource_job.go b/builtin/providers/rundeck/resource_job.go index e3a35b062..7fecbcf41 100644 --- a/builtin/providers/rundeck/resource_job.go +++ b/builtin/providers/rundeck/resource_job.go @@ -183,6 +183,10 @@ func resourceRundeckJob() *schema.Resource { Required: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + "description": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + }, "shell_command": &schema.Schema{ Type: schema.TypeString, Optional: true, @@ -364,6 +368,7 @@ func jobFromResourceData(d *schema.ResourceData) (*rundeck.JobDetail, error) { for _, commandI := range commandConfigs { commandMap := commandI.(map[string]interface{}) command := rundeck.JobCommand{ + Description: commandMap["description"].(string), ShellCommand: commandMap["shell_command"].(string), Script: commandMap["inline_script"].(string), ScriptFile: commandMap["script_file"].(string), @@ -552,6 +557,7 @@ func jobToResourceData(job *rundeck.JobDetail, d *schema.ResourceData) error { d.Set("command_ordering_strategy", job.CommandSequence.OrderingStrategy) for _, command := range job.CommandSequence.Commands { commandConfigI := map[string]interface{}{ + "description": command.Description, "shell_command": command.ShellCommand, "inline_script": command.Script, "script_file": command.ScriptFile, diff --git a/builtin/providers/rundeck/resource_job_test.go b/builtin/providers/rundeck/resource_job_test.go index 182f4a3cf..2bcf6f0e1 100644 --- a/builtin/providers/rundeck/resource_job_test.go +++ b/builtin/providers/rundeck/resource_job_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/apparentlymart/go-rundeck-api/rundeck" - "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" ) @@ -26,6 +25,9 @@ func TestAccJob_basic(t *testing.T) { if expected := "basic-job"; job.Name != expected { return fmt.Errorf("wrong name; expected %v, got %v", expected, job.Name) } + 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) + } return nil }, ), @@ -98,6 +100,7 @@ resource "rundeck_job" "test" { default_value = "bar" } command { + description = "Prints Hello World" shell_command = "echo Hello World" } } From 2178981b44d945248c0377125017b2d1073b3a53 Mon Sep 17 00:00:00 2001 From: Gerben Jacobs Date: Wed, 10 May 2017 14:14:04 +0200 Subject: [PATCH 2/3] update docs for `rundeck_job` resource Change-Id: Id40ae356eaaedf9656b7e38d96d8eb292c9d2cea --- website/source/docs/providers/rundeck/r/job.html.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/source/docs/providers/rundeck/r/job.html.md b/website/source/docs/providers/rundeck/r/job.html.md index 5345c3b24..29b8b7087 100644 --- a/website/source/docs/providers/rundeck/r/job.html.md +++ b/website/source/docs/providers/rundeck/r/job.html.md @@ -125,6 +125,8 @@ The following arguments are supported: `command` blocks must have any one of the following combinations of arguments as contents: +* `description`: (Optional) gives a description to the command block. + * `shell_command` gives a single shell command to execute on the nodes. * `inline_script` gives a whole shell script, inline in the configuration, to execute on the nodes. From c6efb7ad4ca91fc9a0b5155d4eabbb5313a34a32 Mon Sep 17 00:00:00 2001 From: Paul Stack Date: Thu, 11 May 2017 14:32:34 +0300 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5203615c..bad864558 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## 0.9.6 (Unreleased) +IMPROVEMENTS: + +* provider/rundeck: adds `description` to `command` schema in `rundeck_job` resource [GH-14352] + BUG FIXES: * provider/aws: Increase EIP update timeout [GH-14381]