Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
Adding additional debug logs.
Browse files Browse the repository at this point in the history
Added debug logs needed for issue #93.

Signed-off-by: Prativa Bawri <[email protected]>
  • Loading branch information
Prativa20 authored and Vijay Raghavan committed Oct 30, 2018
1 parent bdbd53c commit 13687d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vrealize/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ type byLength []string

//GetActionTemplate - set call for read template/blueprint
func (c *APIClient) GetActionTemplate(resourceViewsTemplate *ResourceView, actionURLString string) (*ActionTemplate, *ResourceView, error) {
log.Info("Getting action template corresponding to the action URL %v \n", actionURLString)
//Fetch an action URL from given template
actionURL := getactionURL(resourceViewsTemplate, actionURLString)
log.Info("The action url is %v ", actionURL)

//Raise an error if action URL not found
if len(actionURL) == 0 {
log.Errorf("The action url is empty")
return nil, resourceViewsTemplate, fmt.Errorf("resource is not created or not found")
}

Expand All @@ -46,6 +49,8 @@ func (c *APIClient) GetActionTemplate(resourceViewsTemplate *ResourceView, actio
return nil, resourceViewsTemplate, apiError
}

log.Info("The action template fetched is %v ", actionTemplate)

return actionTemplate, resourceViewsTemplate, nil
}

Expand Down
3 changes: 3 additions & 0 deletions vrealize/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ func deleteResource(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("Resource not found")
}

log.Info("Calling delete resource for the request id %v ", catalogItemRequestID)
ResourceActions := new(ResourceActions)
apiError := new(APIError)

Expand All @@ -445,6 +446,7 @@ func deleteResource(d *schema.ResourceData, meta interface{}) error {
//If resource create status is in_progress then skip delete call and through an exception
if d.Get(utils.REQUEST_STATUS).(string) != "SUCCESSFUL" {
if d.Get(utils.REQUEST_STATUS).(string) == "FAILED" {
log.Info("The status of the request is FAILED, setting the id to null")
d.SetId("")
return nil
}
Expand All @@ -463,6 +465,7 @@ func deleteResource(d *schema.ResourceData, meta interface{}) error {
DestroyMachineTemplate, resourceTemplate, errDestroyAction := vRAClient.GetDestroyActionTemplate(GetDeploymentStateData)
if errDestroyAction != nil {
if errDestroyAction.Error() == "resource is not created or not found" {
log.Errorf("The destroy action template cannot be retrieved with error, resource is not created or not found")
d.SetId("")
return fmt.Errorf("possibly resource got deleted outside terraform")
}
Expand Down

0 comments on commit 13687d8

Please sign in to comment.