Skip to content

Commit

Permalink
doing cluster and template lookup in the vm read
Browse files Browse the repository at this point in the history
  • Loading branch information
Maigard committed Dec 20, 2017
1 parent 5a0b172 commit 30f0dd8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions ovirt/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,20 @@ func resourceVMRead(d *schema.ResourceData, meta interface{}) error {
return nil
}
d.Set("name", vm.Name)
d.Set("cluster", vm.Cluster.Name)
d.Set("template", vm.Template.Name)

cluster, err := con.GetCluster(vm.Cluster.ID)
if err != nil {
d.SetId("")
return nil
}
d.Set("cluster", cluster.Name)

template, err := con.GetTemplate(vm.Template.ID)
if err != nil {
d.SetId("")
return nil
}
d.Set("template", template.Name)
return nil
}

Expand Down

0 comments on commit 30f0dd8

Please sign in to comment.