Skip to content

Commit

Permalink
[bugfix] Fix import for mso_schema_template_anp_epg_static_leaf to in…
Browse files Browse the repository at this point in the history
…clude template (DCNE-214) (#306)
  • Loading branch information
juchowan authored Oct 24, 2024
1 parent f3b69d5 commit 3973e64
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions mso/resource_mso_schema_site_anp_epg_static_leaf.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ func resourceMSOSchemaSiteAnpEpgStaticleafImport(d *schema.ResourceData, m inter
}

stateSite := get_attribute[2]
stateTemplate := get_attribute[4]
found := false
stateAnp := get_attribute[4]
stateEpg := get_attribute[6]
stateAnp := get_attribute[6]
stateEpg := get_attribute[8]
statePath := import_split[2]

for i := 0; i < count; i++ {
Expand All @@ -99,8 +100,9 @@ func resourceMSOSchemaSiteAnpEpgStaticleafImport(d *schema.ResourceData, m inter
return nil, err
}
apiSite := models.StripQuotes(tempCont.S("siteId").String())
apiTemplate := models.StripQuotes(tempCont.S("templateName").String())

if apiSite == stateSite {
if apiSite == stateSite && apiTemplate == stateTemplate {
anpCount, err := tempCont.ArrayCount("anps")
if err != nil {
return nil, fmt.Errorf("Unable to get Anp list")
Expand Down Expand Up @@ -329,6 +331,7 @@ func resourceMSOSchemaSiteAnpEpgStaticleafRead(d *schema.ResourceData, m interfa

stateSite := d.Get("site_id").(string)
found := false
stateTemplate := d.Get("template_name").(string)
stateAnp := d.Get("anp_name").(string)
stateEpg := d.Get("epg_name").(string)
statePath := d.Get("path").(string)
Expand All @@ -339,8 +342,9 @@ func resourceMSOSchemaSiteAnpEpgStaticleafRead(d *schema.ResourceData, m interfa
return err
}
apiSite := models.StripQuotes(tempCont.S("siteId").String())
apiTemplate := models.StripQuotes(tempCont.S("templateName").String())

if apiSite == stateSite {
if apiSite == stateSite && apiTemplate == stateTemplate {
anpCount, err := tempCont.ArrayCount("anps")
if err != nil {
return fmt.Errorf("Unable to get Anp list")
Expand Down Expand Up @@ -435,6 +439,7 @@ func resourceMSOSchemaSiteAnpEpgStaticleafDelete(d *schema.ResourceData, m inter

index := -1
stateSite := d.Get("site_id").(string)
stateTemplate := d.Get("template_name").(string)
stateAnp := d.Get("anp_name").(string)
stateEpg := d.Get("epg_name").(string)
statePath := d.Get("path").(string)
Expand All @@ -445,8 +450,9 @@ func resourceMSOSchemaSiteAnpEpgStaticleafDelete(d *schema.ResourceData, m inter
return err
}
apiSite := models.StripQuotes(tempCont.S("siteId").String())
apiTemplate := models.StripQuotes(tempCont.S("templateName").String())

if apiSite == stateSite {
if apiSite == stateSite && apiTemplate == stateTemplate {
anpCount, err := tempCont.ArrayCount("anps")
if err != nil {
return fmt.Errorf("Unable to get Anp list")
Expand Down

0 comments on commit 3973e64

Please sign in to comment.