From 4df32aebed07d3d222d90a5fdf6f9a12efe641ab Mon Sep 17 00:00:00 2001 From: Joe Topjian Date: Thu, 12 Feb 2015 20:58:12 +0000 Subject: [PATCH] Changing how security groups are read for compute instances --- .../resource_openstack_compute_instance_v2.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/builtin/providers/openstack/resource_openstack_compute_instance_v2.go b/builtin/providers/openstack/resource_openstack_compute_instance_v2.go index ce6d7772f..9693fb890 100644 --- a/builtin/providers/openstack/resource_openstack_compute_instance_v2.go +++ b/builtin/providers/openstack/resource_openstack_compute_instance_v2.go @@ -366,17 +366,9 @@ func resourceComputeInstanceV2Read(d *schema.ResourceData, meta interface{}) err d.Set("metadata", server.Metadata) secGrpNames := []string{} - err = secgroups.ListByServer(computeClient, d.Id()).EachPage(func(page pagination.Page) (bool, error) { - secGrpList, err := secgroups.ExtractSecurityGroups(page) - if err != nil { - return false, fmt.Errorf("Error getting security groups for OpenStack server: %s", err) - } - log.Printf("[DEBUG] secGrpList: %+v\n\n", secGrpList) - for _, sg := range secGrpList { - secGrpNames = append(secGrpNames, sg.Name) - } - return true, nil - }) + for _, sg := range server.SecurityGroups { + secGrpNames = append(secGrpNames, sg["name"].(string)) + } d.Set("security_groups", secGrpNames) flavorId, ok := server.Flavor["id"].(string)