Skip to content

Commit

Permalink
Merge pull request #50 from rackn/drp-v390-update
Browse files Browse the repository at this point in the history
Drp v390 update
  • Loading branch information
galthaus authored Jun 22, 2018
2 parents 32dc541 + 599e3c2 commit c5af266
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,6 @@ In order to run the full suite of Acceptance tests, run `make testacc`.
*Note:* In this case, acceptances run locally without external resources.

```sh
$ ulimit -n 2560 # for MACs
$ make testacc
```
29 changes: 26 additions & 3 deletions drp/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,29 @@ func buildSchemaFromObject(m interface{}, computed bool) map[string]*schema.Sche
continue
}

// We don't handle maps generically
// Members is map[string][]string
if fieldName == "Members" {
sm["Members"] = &schema.Schema{
Type: schema.TypeMap,
Elem: &schema.Schema{
Type: schema.TypeList,
Elem: &schema.Schema{
Type: schema.TypeString,
},
Optional: true,
Computed: computed,
},
Optional: true,
Computed: computed,
}

continue

}

//
// This is a cluster. Terraform doesn't generic interface{}
// This is a cluster. Terraform doesn't do generic interface{}
// basically, interface{} and map[string]interface{}
//
// Will try some things.
Expand Down Expand Up @@ -116,6 +137,8 @@ func buildSchemaFromObject(m interface{}, computed bool) map[string]*schema.Sche

case "models.TemplateInfo":
sm[fieldName] = buildSchemaListFromObject(&models.TemplateInfo{}, computed)
case "*models.Claim":
sm[fieldName] = buildSchemaListFromObject(&models.Claim{}, computed)
case "uint8":
sm[fieldName] = &schema.Schema{
Type: schema.TypeString,
Expand Down Expand Up @@ -264,7 +287,7 @@ func updateResourceData(m models.Model, d *schema.ResourceData) error {
listType := typeField.Type.String()[2:]

switch listType {
case "string", "*models.DhcpOption", "models.DhcpOption", "models.TemplateInfo":
case "string", "*models.DhcpOption", "models.DhcpOption", "models.TemplateInfo", "*models.Claim":
d.Set(fieldName, valueField.Interface())
case "uint8":
d.Set(fieldName, fmt.Sprintf("%s", valueField.Interface()))
Expand Down Expand Up @@ -371,7 +394,7 @@ func buildModel(m models.Model, d *schema.ResourceData) (models.Model, error) {
subType := typeField.Type.Elem()

switch listType {
case "string", "models.TemplateInfo",
case "string", "models.TemplateInfo", "*models.Claim",
"models.DhcpOption", "*models.DhcpOption":

data := d.Get(fieldName).([]interface{})
Expand Down
8 changes: 5 additions & 3 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c5af266

Please sign in to comment.