Skip to content

Commit

Permalink
Only refresh project name if Rundeck server provides it.
Browse files Browse the repository at this point in the history
It seems that not all Rundeck servers consistently return the project name
when retrieving a job. Not yet sure in what situations it is or isn't
returned, but since jobs are not allowed to move between projects anyway
it doesn't hurt to just skip refreshing it if the server provides no
value.
  • Loading branch information
apparentlymart committed Dec 14, 2015
1 parent 86882e3 commit 98fc16e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion builtin/providers/rundeck/resource_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,14 @@ func jobToResourceData(job *rundeck.JobDetail, d *schema.ResourceData) error {
d.Set("id", job.ID)
d.Set("name", job.Name)
d.Set("group_name", job.GroupName)
d.Set("project_name", job.ProjectName)

// The project name is not consistently returned in all rundeck versions,
// so we'll only update it if it's set. Jobs can't move between projects
// anyway, so this is harmless.
if job.ProjectName != "" {
d.Set("project_name", job.ProjectName)
}

d.Set("description", job.Description)
d.Set("log_level", job.LogLevel)
d.Set("allow_concurrent_executions", job.AllowConcurrentExecutions)
Expand Down

0 comments on commit 98fc16e

Please sign in to comment.