From 13687d8731a6b4c637bd01fe5bbe1e6cbad39203 Mon Sep 17 00:00:00 2001 From: Prativa Bawri Date: Tue, 30 Oct 2018 15:58:15 -0700 Subject: [PATCH] Adding additional debug logs. Added debug logs needed for issue #93. Signed-off-by: Prativa Bawri --- vrealize/actions.go | 5 +++++ vrealize/resource.go | 3 +++ 2 files changed, 8 insertions(+) diff --git a/vrealize/actions.go b/vrealize/actions.go index e4416f2..31e5d14 100644 --- a/vrealize/actions.go +++ b/vrealize/actions.go @@ -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") } @@ -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 } diff --git a/vrealize/resource.go b/vrealize/resource.go index 15c0b52..d3575e0 100644 --- a/vrealize/resource.go +++ b/vrealize/resource.go @@ -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) @@ -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 } @@ -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") }