diff --git a/builder/oracle/classic/step_create_instance.go b/builder/oracle/classic/step_create_instance.go index bf89a51e3..88c108466 100644 --- a/builder/oracle/classic/step_create_instance.go +++ b/builder/oracle/classic/step_create_instance.go @@ -20,7 +20,6 @@ func (s *stepCreateInstance) Run(state multistep.StateBag) multistep.StepAction keyName := state.Get("key_name").(string) ipAddName := fmt.Sprintf("ipres_%s", config.ImageName) - // secListName := "Megan_packer_test" // hack to get working; fix b4 release secListName := state.Get("security_list").(string) netInfo := compute.NetworkingInfo{ diff --git a/builder/oracle/classic/step_security.go b/builder/oracle/classic/step_security.go index d82f2bc41..cc965caeb 100644 --- a/builder/oracle/classic/step_security.go +++ b/builder/oracle/classic/step_security.go @@ -71,23 +71,26 @@ func (s *stepSecurity) Cleanup(state multistep.StateBag) { client := state.Get("client").(*compute.ComputeClient) ui := state.Get("ui").(packer.Ui) ui.Say("Deleting the packer-generated security rules and lists...") - // delete security list that Packer generated - secListName := state.Get("security_list").(string) - secListClient := client.SecurityLists() - input := compute.DeleteSecurityListInput{Name: secListName} - err := secListClient.DeleteSecurityList(&input) - if err != nil { - ui.Say(fmt.Sprintf("Error deleting the packer-generated security list %s; "+ - "please delete manually. (error : %s)", secListName, err.Error())) - } + // delete security rules that Packer generated secRuleName := state.Get("security_rule_name").(string) secRulesClient := client.SecRules() ruleInput := compute.DeleteSecRuleInput{Name: secRuleName} - err = secRulesClient.DeleteSecRule(&ruleInput) + err := secRulesClient.DeleteSecRule(&ruleInput) if err != nil { ui.Say(fmt.Sprintf("Error deleting the packer-generated security rule %s; "+ "please delete manually. (error: %s)", secRuleName, err.Error())) } + + // delete security list that Packer generated + secListName := state.Get("security_list").(string) + secListClient := client.SecurityLists() + input := compute.DeleteSecurityListInput{Name: secListName} + err = secListClient.DeleteSecurityList(&input) + if err != nil { + ui.Say(fmt.Sprintf("Error deleting the packer-generated security list %s; "+ + "please delete manually. (error : %s)", secListName, err.Error())) + } + return }