Skip to content

Commit

Permalink
Fix issue where local_path was blocking versioning in git projects
Browse files Browse the repository at this point in the history
  • Loading branch information
f0rkz committed Feb 14, 2022
1 parent d213bfd commit ab1642e
Showing 1 changed file with 32 additions and 14 deletions.
46 changes: 32 additions & 14 deletions awx/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,38 @@ func resourceProjectUpdate(ctx context.Context, d *schema.ResourceData, m interf
if d.Get("scm_credential_id").(int) > 0 {
credentials = strconv.Itoa(d.Get("scm_credential_id").(int))
}
_, err := awxService.UpdateProject(id, map[string]interface{}{
"name": d.Get("name").(string),
"description": d.Get("description").(string),
"local_path": d.Get("local_path").(string),
"scm_type": d.Get("scm_type").(string),
"scm_url": d.Get("scm_url").(string),
"scm_branch": d.Get("scm_branch").(string),
"scm_clean": d.Get("scm_clean").(bool),
"scm_delete_on_update": d.Get("scm_delete_on_update").(bool),
"credential": credentials,
"organization": d.Get("organization_id").(int),
"scm_update_on_launch": d.Get("scm_update_on_launch").(bool),
"scm_update_cache_timeout": d.Get("scm_update_cache_timeout").(int),
}, map[string]string{})
params := make(map[string]interface{})
if d.Get("scm_type").(string) == "" {
params = map[string]interface{}{
"name": d.Get("name").(string),
"description": d.Get("description").(string),
"local_path": d.Get("local_path").(string),
"scm_type": d.Get("scm_type").(string),
"scm_url": d.Get("scm_url").(string),
"scm_branch": d.Get("scm_branch").(string),
"scm_clean": d.Get("scm_clean").(bool),
"scm_delete_on_update": d.Get("scm_delete_on_update").(bool),
"credential": credentials,
"organization": d.Get("organization_id").(int),
"scm_update_on_launch": d.Get("scm_update_on_launch").(bool),
"scm_update_cache_timeout": d.Get("scm_update_cache_timeout").(int),
}
} else {
params = map[string]interface{}{
"name": d.Get("name").(string),
"description": d.Get("description").(string),
"scm_type": d.Get("scm_type").(string),
"scm_url": d.Get("scm_url").(string),
"scm_branch": d.Get("scm_branch").(string),
"scm_clean": d.Get("scm_clean").(bool),
"scm_delete_on_update": d.Get("scm_delete_on_update").(bool),
"credential": credentials,
"organization": d.Get("organization_id").(int),
"scm_update_on_launch": d.Get("scm_update_on_launch").(bool),
"scm_update_cache_timeout": d.Get("scm_update_cache_timeout").(int),
}
}
_, err := awxService.UpdateProject(id, params, map[string]string{})
if err != nil {
return buildDiagnosticsMessage("Update: Fail To Update Project", "Fail to get Project with ID %v, got %s", id, err.Error())
}
Expand Down

0 comments on commit ab1642e

Please sign in to comment.