Skip to content

Commit 9ef2a40

Browse files
authored
Merge pull request #3427 from kayrus/secgroup-name-update
neutron: support security group empty name update
2 parents 20de1bc + c759860 commit 9ef2a40

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

internal/acceptance/openstack/networking/v2/extensions/security_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestSecurityGroupsCreateUpdateDelete(t *testing.T) {
3939
var name = "Update group"
4040
var description = ""
4141
updateOpts := groups.UpdateOpts{
42-
Name: name,
42+
Name: &name,
4343
Description: &description,
4444
Stateful: new(bool),
4545
}
@@ -115,7 +115,7 @@ func TestSecurityGroupsRevision(t *testing.T) {
115115
newName := tools.RandomString("TESTACC-", 8)
116116
newDescription := ""
117117
updateOpts := &groups.UpdateOpts{
118-
Name: newName,
118+
Name: &newName,
119119
Description: &newDescription,
120120
}
121121
group, err = groups.Update(context.TODO(), client, group.ID, updateOpts).Extract()
@@ -126,7 +126,6 @@ func TestSecurityGroupsRevision(t *testing.T) {
126126
// This should fail due to an old revision number.
127127
newDescription = "new description"
128128
updateOpts = &groups.UpdateOpts{
129-
Name: newName,
130129
Description: &newDescription,
131130
RevisionNumber: &oldRevisionNumber,
132131
}
@@ -145,7 +144,7 @@ func TestSecurityGroupsRevision(t *testing.T) {
145144
// This should work because now we do provide a valid revision number.
146145
newDescription = "new description"
147146
updateOpts = &groups.UpdateOpts{
148-
Name: newName,
147+
Name: new(string),
149148
Description: &newDescription,
150149
RevisionNumber: &group.RevisionNumber,
151150
}
@@ -154,7 +153,7 @@ func TestSecurityGroupsRevision(t *testing.T) {
154153

155154
tools.PrintResource(t, group)
156155

157-
th.AssertEquals(t, group.Name, newName)
156+
th.AssertEquals(t, group.Name, "")
158157
th.AssertEquals(t, group.Description, newDescription)
159158
}
160159

openstack/networking/v2/extensions/security/groups/requests.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ type UpdateOptsBuilder interface {
114114
// group.
115115
type UpdateOpts struct {
116116
// Human-readable name for the Security Group. Does not have to be unique.
117-
Name string `json:"name,omitempty"`
117+
Name *string `json:"name,omitempty"`
118118

119119
// Describes the security group.
120120
Description *string `json:"description,omitempty"`

openstack/networking/v2/extensions/security/groups/testing/requests_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ func TestUpdate(t *testing.T) {
9090
fmt.Fprint(w, SecurityGroupUpdateResponse)
9191
})
9292

93-
opts := groups.UpdateOpts{Name: "newer-webservers"}
93+
name := "newer-webservers"
94+
opts := groups.UpdateOpts{Name: &name}
9495
sg, err := groups.Update(context.TODO(), fake.ServiceClient(fakeServer), "2076db17-a522-4506-91de-c6dd8e837028", opts).Extract()
9596
th.AssertNoErr(t, err)
9697

0 commit comments

Comments
 (0)