Ensuring we output the error when things fail
This commit is contained in:
parent
01c8b0197c
commit
70e69a7387
|
@ -144,7 +144,7 @@ func resourceArmEventHubAuthorizationRuleRead(d *schema.ResourceData, meta inter
|
||||||
|
|
||||||
resp, err := client.GetAuthorizationRule(resGroup, namespaceName, eventHubName, name)
|
resp, err := client.GetAuthorizationRule(resGroup, namespaceName, eventHubName, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error making Read request on Azure EventHub Authorization Rule %s: %s", name, err)
|
return fmt.Errorf("Error making Read request on Azure EventHub Authorization Rule %s: %+v", name, err)
|
||||||
}
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
|
@ -153,7 +153,7 @@ func resourceArmEventHubAuthorizationRuleRead(d *schema.ResourceData, meta inter
|
||||||
|
|
||||||
keysResp, err := client.ListKeys(resGroup, namespaceName, eventHubName, name)
|
keysResp, err := client.ListKeys(resGroup, namespaceName, eventHubName, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error making Read request on Azure EventHub Authorization Rule List Keys %s: %s", name, err)
|
return fmt.Errorf("Error making Read request on Azure EventHub Authorization Rule List Keys %s: %+v", name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.Set("name", name)
|
d.Set("name", name)
|
||||||
|
@ -187,7 +187,7 @@ func resourceArmEventHubAuthorizationRuleDelete(d *schema.ResourceData, meta int
|
||||||
resp, err := eventhubClient.DeleteAuthorizationRule(resGroup, namespaceName, eventHubName, name)
|
resp, err := eventhubClient.DeleteAuthorizationRule(resGroup, namespaceName, eventHubName, name)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Authorization Rule '%s': %s", name, err)
|
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Authorization Rule '%s': %+v", name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -109,7 +109,7 @@ func resourceArmEventHubConsumerGroupRead(d *schema.ResourceData, meta interface
|
||||||
|
|
||||||
resp, err := eventhubClient.Get(resGroup, namespaceName, eventHubName, name)
|
resp, err := eventhubClient.Get(resGroup, namespaceName, eventHubName, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error making Read request on Azure EventHub Consumer Group %s: %s", name, err)
|
return fmt.Errorf("Error making Read request on Azure EventHub Consumer Group %s: %+v", name, err)
|
||||||
}
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
|
@ -141,7 +141,7 @@ func resourceArmEventHubConsumerGroupDelete(d *schema.ResourceData, meta interfa
|
||||||
resp, err := eventhubClient.Delete(resGroup, namespaceName, eventHubName, name)
|
resp, err := eventhubClient.Delete(resGroup, namespaceName, eventHubName, name)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Consumer Group '%s': %s", name, err)
|
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Consumer Group '%s': %+v", name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -131,7 +131,7 @@ func resourceArmEventHubNamespaceRead(d *schema.ResourceData, meta interface{})
|
||||||
|
|
||||||
resp, err := namespaceClient.Get(resGroup, name)
|
resp, err := namespaceClient.Get(resGroup, name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error making Read request on Azure EventHub Namespace %s: %s", name, err)
|
return fmt.Errorf("Error making Read request on Azure EventHub Namespace %s: %+v", name, err)
|
||||||
}
|
}
|
||||||
if resp.StatusCode == http.StatusNotFound {
|
if resp.StatusCode == http.StatusNotFound {
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
|
@ -146,7 +146,7 @@ func resourceArmEventHubNamespaceRead(d *schema.ResourceData, meta interface{})
|
||||||
|
|
||||||
keys, err := namespaceClient.ListKeys(resGroup, name, eventHubNamespaceDefaultAuthorizationRule)
|
keys, err := namespaceClient.ListKeys(resGroup, name, eventHubNamespaceDefaultAuthorizationRule)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Unable to List default keys for Namespace %s: %s", name, err)
|
log.Printf("[ERROR] Unable to List default keys for Namespace %s: %+v", name, err)
|
||||||
} else {
|
} else {
|
||||||
d.Set("default_primary_connection_string", keys.PrimaryConnectionString)
|
d.Set("default_primary_connection_string", keys.PrimaryConnectionString)
|
||||||
d.Set("default_secondary_connection_string", keys.SecondaryConnectionString)
|
d.Set("default_secondary_connection_string", keys.SecondaryConnectionString)
|
||||||
|
@ -160,7 +160,6 @@ func resourceArmEventHubNamespaceRead(d *schema.ResourceData, meta interface{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceArmEventHubNamespaceDelete(d *schema.ResourceData, meta interface{}) error {
|
func resourceArmEventHubNamespaceDelete(d *schema.ResourceData, meta interface{}) error {
|
||||||
|
|
||||||
namespaceClient := meta.(*ArmClient).eventHubNamespacesClient
|
namespaceClient := meta.(*ArmClient).eventHubNamespacesClient
|
||||||
|
|
||||||
id, err := parseAzureResourceID(d.Id())
|
id, err := parseAzureResourceID(d.Id())
|
||||||
|
@ -173,7 +172,7 @@ func resourceArmEventHubNamespaceDelete(d *schema.ResourceData, meta interface{}
|
||||||
resp, err := namespaceClient.Delete(resGroup, name, make(chan struct{}))
|
resp, err := namespaceClient.Delete(resGroup, name, make(chan struct{}))
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusNotFound {
|
if resp.StatusCode != http.StatusNotFound {
|
||||||
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Namespace'%s': %s", name, err)
|
return fmt.Errorf("Error issuing Azure ARM delete request of EventHub Namespace '%s': %+v", name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue