Skip to content

Commit

Permalink
Check errors on setting non-scalars (#52)
Browse files Browse the repository at this point in the history
* FloatingIPV2: check error on setting servers

Check error on setting non-scalar attribute.

* LicenseV2: check error on setting servers

Check error on setting non-scalar attribute.

* ProjectV2: check error on setting non-scalars

Check error on setting non-scalar "all_quotas" and "theme" attributes.
  • Loading branch information
ozerovandrei authored Nov 13, 2018
1 parent 83f676d commit 9a2291b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 4 additions & 1 deletion selvpc/resource_selvpc_resell_floatingip_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ func resourceResellFloatingIPV2Read(d *schema.ResourceData, meta interface{}) er
d.Set("project_id", floatingIP.ProjectID)
d.Set("region", floatingIP.Region)
d.Set("status", floatingIP.Status)

associatedServers := serversMapsFromStructs(floatingIP.Servers)
d.Set("servers", associatedServers)
if err := d.Set("servers", associatedServers); err != nil {
log.Printf("[DEBUG] servers: %s", err)
}

return nil
}
Expand Down
4 changes: 3 additions & 1 deletion selvpc/resource_selvpc_resell_license_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ func resourceResellLicenseV2Read(d *schema.ResourceData, meta interface{}) error
d.Set("status", license.Status)
d.Set("type", license.Type)
associatedServers := serversMapsFromStructs(license.Servers)
d.Set("servers", associatedServers)
if err := d.Set("servers", associatedServers); err != nil {
log.Printf("[DEBUG] servers: %s", err)
}

return nil
}
Expand Down
8 changes: 6 additions & 2 deletions selvpc/resource_selvpc_resell_project_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,16 @@ func resourceResellProjectV2Read(d *schema.ResourceData, meta interface{}) error
d.Set("name", project.Name)
d.Set("url", project.URL)
d.Set("enabled", project.Enabled)
d.Set("theme", project.Theme)
if err := d.Set("theme", project.Theme); err != nil {
log.Printf("[DEBUG] theme: %s", err)
}

// Set all quotas. This can be different from what the user specified since
// the project will have all available resource quotas automatically applied.
allQuotas := resourceResellProjectV2QuotasToSet(project.Quotas)
d.Set("all_quotas", allQuotas)
if err := d.Set("all_quotas", allQuotas); err != nil {
log.Printf("[DEBUG] all_quotas: %s", err)
}

return nil
}
Expand Down

0 comments on commit 9a2291b

Please sign in to comment.