Skip to content

Commit d45ffa4

Browse files
#787 fixed gosec errors, ran go fmt
1 parent 306d233 commit d45ffa4

3 files changed

Lines changed: 27 additions & 1 deletion

File tree

plugin/commands/dedicatedhost/cancel_guest.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package dedicatedhost
22

33
import (
44
"github.com/spf13/cobra"
5-
5+
66
slErr "github.ibm.com/SoftLayer/softlayer-cli/plugin/errors"
77
"github.ibm.com/SoftLayer/softlayer-cli/plugin/metadata"
88

@@ -61,6 +61,8 @@ func (cmd *CancelCommand) Run(args []string) error {
6161
if len(listGuest) > 0 {
6262
table := cmd.UI.Table([]string{T("Id"), T("Server Name"), T("Status")})
6363
for _, guest := range listGuest {
64+
//#nosec G601 -- utils.FormatXPointer returns the value of the memory address, so this is not a problem.
65+
//Test Issues787 assures this condition.
6466
table.Add(utils.FormatIntPointer(&guest.Id), utils.FormatStringPointer(&guest.Fqdn), utils.FormatStringPointer(&guest.Status))
6567
}
6668
table.Print()

plugin/commands/dedicatedhost/cancel_guest_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,28 @@ var _ = Describe("Dedicated host create", func() {
9191
})
9292
})
9393

94+
Context("Dedicatedhost VS cancel vs successfully - multiple", func() {
95+
BeforeEach(func() {
96+
FakeDedicatedhostManager.CancelGuestsReturns([]managers.StatusInfo{
97+
{
98+
Id: *sl.Int(1234567),
99+
Fqdn: *sl.String("test.softlayer"),
100+
Status: *sl.String("Cancelled"),
101+
},
102+
{
103+
Id: *sl.Int(9999),
104+
Fqdn: *sl.String("qqq.aaa"),
105+
Status: *sl.String("Cancelled"),
106+
},
107+
}, nil)
108+
})
109+
It("return no error", func() {
110+
err := testhelpers.RunCobraCommand(cliCommand.Command, "1234", "-f")
111+
Expect(err).NotTo(HaveOccurred())
112+
Expect(fakeUI.Outputs()).To(ContainSubstring("1234567"))
113+
Expect(fakeUI.Outputs()).To(ContainSubstring("9999"))
114+
})
115+
})
116+
94117
})
95118
})

plugin/managers/network.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ func (n networkManager) AddSubnet(subnetType string, quantity int, vlanID int, v
220220
quantity = 0
221221
category = "global_ipv4"
222222
} else if subnetType == "public" {
223+
//#nosec G101 -- Not a credential
223224
category = "sov_sec_ip_addresses_pub"
224225
}
225226
} else {

0 commit comments

Comments
 (0)