Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e752cb3

Browse filesBrowse files
committed
Fix potential panics
1 parent 7bf7b5d commit e752cb3
Copy full SHA for e752cb3

File tree

109 files changed

+556
-139
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

109 files changed

+556
-139
lines changed

‎docs/contributor-tutorial/.template/requests.go

Copy file name to clipboardExpand all lines: docs/contributor-tutorial/.template/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ type ListOpts struct {
2020
// ToResourceListQuery formats a ListOpts into a query string.
2121
func (opts ListOpts) ToResourceListQuery() (string, error) {
2222
q, err := gophercloud.BuildQueryString(opts)
23-
return q.String(), err
23+
if err != nil {
24+
return "", nil
25+
}
26+
return q.String(), nil
2427
}
2528

2629
// List retrieves a list of RESOURCES.

‎openstack/baremetal/v1/allocations/requests.go

Copy file name to clipboardExpand all lines: openstack/baremetal/v1/allocations/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ type ListOpts struct {
101101
// ToAllocationListQuery formats a ListOpts into a query string.
102102
func (opts ListOpts) ToAllocationListQuery() (string, error) {
103103
q, err := gophercloud.BuildQueryString(opts)
104-
return q.String(), err
104+
if err != nil {
105+
return "", nil
106+
}
107+
return q.String(), nil
105108
}
106109

107110
// List makes a request against the API to list allocations accessible to you.

‎openstack/baremetal/v1/conductors/requests.go

Copy file name to clipboardExpand all lines: openstack/baremetal/v1/conductors/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ func (opts ListOpts) ToConductorListQuery() (string, error) {
4545
}
4646

4747
q, err := gophercloud.BuildQueryString(opts)
48-
return q.String(), err
48+
if err != nil {
49+
return "", nil
50+
}
51+
return q.String(), nil
4952
}
5053

5154
// List makes a request against the API to list conductors accessible to you.

‎openstack/baremetal/v1/drivers/requests.go

Copy file name to clipboardExpand all lines: openstack/baremetal/v1/drivers/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ type ListDriversOpts struct {
2525
// ToListDriversOptsQuery formats a ListOpts into a query string
2626
func (opts ListDriversOpts) ToListDriversOptsQuery() (string, error) {
2727
q, err := gophercloud.BuildQueryString(opts)
28-
return q.String(), err
28+
if err != nil {
29+
return "", nil
30+
}
31+
return q.String(), nil
2932
}
3033

3134
// ListDrivers makes a request against the API to list all drivers

‎openstack/baremetal/v1/nodes/requests.go

Copy file name to clipboardExpand all lines: openstack/baremetal/v1/nodes/requests.go
+20-5Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ type ListOpts struct {
135135
// ToNodeListQuery formats a ListOpts into a query string.
136136
func (opts ListOpts) ToNodeListQuery() (string, error) {
137137
q, err := gophercloud.BuildQueryString(opts)
138-
return q.String(), err
138+
if err != nil {
139+
return "", nil
140+
}
141+
return q.String(), nil
139142
}
140143

141144
// List makes a request against the API to list nodes accessible to you.
@@ -161,7 +164,10 @@ func (opts ListOpts) ToNodeListDetailQuery() (string, error) {
161164
}
162165

163166
q, err := gophercloud.BuildQueryString(opts)
164-
return q.String(), err
167+
if err != nil {
168+
return "", nil
169+
}
170+
return q.String(), nil
165171
}
166172

167173
// Return a list of bare metal Nodes with complete details. Some filtering is possible by passing in flags in ListOpts,
@@ -692,7 +698,10 @@ func (opts ListBIOSSettingsOpts) ToListBIOSSettingsOptsQuery() (string, error) {
692698
}
693699

694700
q, err := gophercloud.BuildQueryString(opts)
695-
return q.String(), err
701+
if err != nil {
702+
return "", nil
703+
}
704+
return q.String(), nil
696705
}
697706

698707
// Get the current BIOS Settings for the given Node.
@@ -733,7 +742,10 @@ type CallVendorPassthruOpts struct {
733742
// ToGetSubscriptionMap assembles a query based on the contents of a CallVendorPassthruOpts
734743
func ToGetAllSubscriptionMap(opts CallVendorPassthruOpts) (string, error) {
735744
q, err := gophercloud.BuildQueryString(opts)
736-
return q.String(), err
745+
if err != nil {
746+
return "", nil
747+
}
748+
return q.String(), nil
737749
}
738750

739751
// Get all vendor_passthru methods available for the given Node.
@@ -985,7 +997,10 @@ type DetachVirtualMediaOptsBuilder interface {
985997

986998
func (opts DetachVirtualMediaOpts) ToDetachVirtualMediaOptsQuery() (string, error) {
987999
q, err := gophercloud.BuildQueryString(opts)
988-
return q.String(), err
1000+
if err != nil {
1001+
return "", nil
1002+
}
1003+
return q.String(), nil
9891004
}
9901005

9911006
// Request to detach a virtual media device from the Node.

‎openstack/baremetal/v1/portgroups/requests.go

Copy file name to clipboardExpand all lines: openstack/baremetal/v1/portgroups/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ type ListOpts struct {
114114
// ToPortGroupListQuery formats a ListOpts into a query string.
115115
func (opts ListOpts) ToPortGroupListQuery() (string, error) {
116116
q, err := gophercloud.BuildQueryString(opts)
117-
return q.String(), err
117+
if err != nil {
118+
return "", nil
119+
}
120+
return q.String(), nil
118121
}
119122

120123
// List makes a request against the API to list portgroups accessible to you.

‎openstack/baremetal/v1/ports/requests.go

Copy file name to clipboardExpand all lines: openstack/baremetal/v1/ports/requests.go
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ type ListOpts struct {
5252
// ToPortListQuery formats a ListOpts into a query string.
5353
func (opts ListOpts) ToPortListQuery() (string, error) {
5454
q, err := gophercloud.BuildQueryString(opts)
55-
return q.String(), err
55+
if err != nil {
56+
return "", nil
57+
}
58+
return q.String(), nil
5659
}
5760

5861
// List makes a request against the API to list ports accessible to you.
@@ -78,7 +81,10 @@ func (opts ListOpts) ToPortListDetailQuery() (string, error) {
7881
}
7982

8083
q, err := gophercloud.BuildQueryString(opts)
81-
return q.String(), err
84+
if err != nil {
85+
return "", nil
86+
}
87+
return q.String(), nil
8288
}
8389

8490
// ListDetail - Return a list ports with complete details.

‎openstack/baremetalintrospection/v1/introspection/requests.go

Copy file name to clipboardExpand all lines: openstack/baremetalintrospection/v1/introspection/requests.go
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ type ListIntrospectionsOpts struct {
2828
// ToIntrospectionsListQuery formats a ListIntrospectionsOpts into a query string.
2929
func (opts ListIntrospectionsOpts) ToIntrospectionsListQuery() (string, error) {
3030
q, err := gophercloud.BuildQueryString(opts)
31-
return q.String(), err
31+
if err != nil {
32+
return "", nil
33+
}
34+
return q.String(), nil
3235
}
3336

3437
// ListIntrospections makes a request against the Inspector API to list the current introspections.
@@ -72,7 +75,10 @@ type StartOpts struct {
7275
// ToStartIntrospectionQuery converts a StartOpts into a request.
7376
func (opts StartOpts) ToStartIntrospectionQuery() (string, error) {
7477
q, err := gophercloud.BuildQueryString(opts)
75-
return q.String(), err
78+
if err != nil {
79+
return "", nil
80+
}
81+
return q.String(), nil
7682
}
7783

7884
// StartIntrospection initiate hardware introspection for node NodeID .

‎openstack/blockstorage/v2/backups/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v2/backups/requests.go
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ type ListOpts struct {
128128
// ToBackupListQuery formats a ListOpts into a query string.
129129
func (opts ListOpts) ToBackupListQuery() (string, error) {
130130
q, err := gophercloud.BuildQueryString(opts)
131-
return q.String(), err
131+
if err != nil {
132+
return "", nil
133+
}
134+
return q.String(), nil
132135
}
133136

134137
// List returns Backups optionally limited by the conditions provided in
@@ -177,7 +180,10 @@ type ListDetailOpts struct {
177180
// ToBackupListDetailQuery formats a ListDetailOpts into a query string.
178181
func (opts ListDetailOpts) ToBackupListDetailQuery() (string, error) {
179182
q, err := gophercloud.BuildQueryString(opts)
180-
return q.String(), err
183+
if err != nil {
184+
return "", nil
185+
}
186+
return q.String(), nil
181187
}
182188

183189
// ListDetail returns more detailed information about Backups optionally

‎openstack/blockstorage/v2/schedulerstats/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v2/schedulerstats/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ type ListOpts struct {
2424
// ToStoragePoolsListQuery formats a ListOpts into a query string.
2525
func (opts ListOpts) ToStoragePoolsListQuery() (string, error) {
2626
q, err := gophercloud.BuildQueryString(opts)
27-
return q.String(), err
27+
if err != nil {
28+
return "", nil
29+
}
30+
return q.String(), nil
2831
}
2932

3033
// List makes a request against the API to list storage pool information.

‎openstack/blockstorage/v2/services/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v2/services/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ type ListOpts struct {
2323
// ToServiceListQuery formats a ListOpts into a query string.
2424
func (opts ListOpts) ToServiceListQuery() (string, error) {
2525
q, err := gophercloud.BuildQueryString(opts)
26-
return q.String(), err
26+
if err != nil {
27+
return "", nil
28+
}
29+
return q.String(), nil
2730
}
2831

2932
// List makes a request against the API to list services.

‎openstack/blockstorage/v2/snapshots/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v2/snapshots/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ type ListOpts struct {
9090
// ToSnapshotListQuery formats a ListOpts into a query string.
9191
func (opts ListOpts) ToSnapshotListQuery() (string, error) {
9292
q, err := gophercloud.BuildQueryString(opts)
93-
return q.String(), err
93+
if err != nil {
94+
return "", nil
95+
}
96+
return q.String(), nil
9497
}
9598

9699
// List returns Snapshots optionally limited by the conditions provided in

‎openstack/blockstorage/v2/transfers/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v2/transfers/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ type ListOpts struct {
110110
// ToTransferListQuery formats a ListOpts into a query string.
111111
func (opts ListOpts) ToTransferListQuery() (string, error) {
112112
q, err := gophercloud.BuildQueryString(opts)
113-
return q.String(), err
113+
if err != nil {
114+
return "", nil
115+
}
116+
return q.String(), nil
114117
}
115118

116119
// List returns Transfers optionally limited by the conditions provided in ListOpts.

‎openstack/blockstorage/v2/volumes/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v2/volumes/requests.go
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ type DeleteOpts struct {
179179
// ToLoadBalancerDeleteQuery formats a DeleteOpts into a query string.
180180
func (opts DeleteOpts) ToVolumeDeleteQuery() (string, error) {
181181
q, err := gophercloud.BuildQueryString(opts)
182-
return q.String(), err
182+
if err != nil {
183+
return "", nil
184+
}
185+
return q.String(), nil
183186
}
184187

185188
// Delete will delete the existing Volume with the provided ID.
@@ -248,7 +251,10 @@ type ListOpts struct {
248251
// ToVolumeListQuery formats a ListOpts into a query string.
249252
func (opts ListOpts) ToVolumeListQuery() (string, error) {
250253
q, err := gophercloud.BuildQueryString(opts)
251-
return q.String(), err
254+
if err != nil {
255+
return "", nil
256+
}
257+
return q.String(), nil
252258
}
253259

254260
// List returns Volumes optionally limited by the conditions provided in ListOpts.

‎openstack/blockstorage/v3/attachments/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v3/attachments/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ type ListOpts struct {
113113
// ToAttachmentListQuery formats a ListOpts into a query string.
114114
func (opts ListOpts) ToAttachmentListQuery() (string, error) {
115115
q, err := gophercloud.BuildQueryString(opts)
116-
return q.String(), err
116+
if err != nil {
117+
return "", nil
118+
}
119+
return q.String(), nil
117120
}
118121

119122
// List returns Attachments optionally limited by the conditions provided in

‎openstack/blockstorage/v3/backups/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v3/backups/requests.go
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ type ListOpts struct {
128128
// ToBackupListQuery formats a ListOpts into a query string.
129129
func (opts ListOpts) ToBackupListQuery() (string, error) {
130130
q, err := gophercloud.BuildQueryString(opts)
131-
return q.String(), err
131+
if err != nil {
132+
return "", nil
133+
}
134+
return q.String(), nil
132135
}
133136

134137
// List returns Backups optionally limited by the conditions provided in
@@ -177,7 +180,10 @@ type ListDetailOpts struct {
177180
// ToBackupListDetailQuery formats a ListDetailOpts into a query string.
178181
func (opts ListDetailOpts) ToBackupListDetailQuery() (string, error) {
179182
q, err := gophercloud.BuildQueryString(opts)
180-
return q.String(), err
183+
if err != nil {
184+
return "", nil
185+
}
186+
return q.String(), nil
181187
}
182188

183189
// ListDetail returns more detailed information about Backups optionally

‎openstack/blockstorage/v3/qos/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v3/qos/requests.go
+16-4Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ type DeleteOpts struct {
8989
// ToQoSDeleteQuery formats a DeleteOpts into a query string.
9090
func (opts DeleteOpts) ToQoSDeleteQuery() (string, error) {
9191
q, err := gophercloud.BuildQueryString(opts)
92-
return q.String(), err
92+
if err != nil {
93+
return "", nil
94+
}
95+
return q.String(), nil
9396
}
9497

9598
// Delete will delete the existing QoS with the provided ID.
@@ -126,7 +129,10 @@ type ListOpts struct {
126129
// ToQoSListQuery formats a ListOpts into a query string.
127130
func (opts ListOpts) ToQoSListQuery() (string, error) {
128131
q, err := gophercloud.BuildQueryString(opts)
129-
return q.String(), err
132+
if err != nil {
133+
return "", nil
134+
}
135+
return q.String(), nil
130136
}
131137

132138
// List instructs OpenStack to provide a list of QoS.
@@ -256,7 +262,10 @@ type AssociateOpts struct {
256262
// ToQosAssociateQuery formats an AssociateOpts into a query string
257263
func (opts AssociateOpts) ToQosAssociateQuery() (string, error) {
258264
q, err := gophercloud.BuildQueryString(opts)
259-
return q.String(), err
265+
if err != nil {
266+
return "", nil
267+
}
268+
return q.String(), nil
260269
}
261270

262271
// Associate will associate a qos with a volute type
@@ -291,7 +300,10 @@ type DisassociateOpts struct {
291300
// ToQosDisassociateQuery formats a DisassociateOpts into a query string
292301
func (opts DisassociateOpts) ToQosDisassociateQuery() (string, error) {
293302
q, err := gophercloud.BuildQueryString(opts)
294-
return q.String(), err
303+
if err != nil {
304+
return "", nil
305+
}
306+
return q.String(), nil
295307
}
296308

297309
// Disassociate will disassociate a qos from a volute type

‎openstack/blockstorage/v3/schedulerstats/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v3/schedulerstats/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ type ListOpts struct {
2424
// ToStoragePoolsListQuery formats a ListOpts into a query string.
2525
func (opts ListOpts) ToStoragePoolsListQuery() (string, error) {
2626
q, err := gophercloud.BuildQueryString(opts)
27-
return q.String(), err
27+
if err != nil {
28+
return "", nil
29+
}
30+
return q.String(), nil
2831
}
2932

3033
// List makes a request against the API to list storage pool information.

‎openstack/blockstorage/v3/services/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v3/services/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ type ListOpts struct {
2323
// ToServiceListQuery formats a ListOpts into a query string.
2424
func (opts ListOpts) ToServiceListQuery() (string, error) {
2525
q, err := gophercloud.BuildQueryString(opts)
26-
return q.String(), err
26+
if err != nil {
27+
return "", nil
28+
}
29+
return q.String(), nil
2730
}
2831

2932
// List makes a request against the API to list services.

‎openstack/blockstorage/v3/snapshots/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v3/snapshots/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ type ListOpts struct {
103103
// ToSnapshotListQuery formats a ListOpts into a query string.
104104
func (opts ListOpts) ToSnapshotListQuery() (string, error) {
105105
q, err := gophercloud.BuildQueryString(opts)
106-
return q.String(), err
106+
if err != nil {
107+
return "", nil
108+
}
109+
return q.String(), nil
107110
}
108111

109112
// List returns Snapshots optionally limited by the conditions provided in

‎openstack/blockstorage/v3/transfers/requests.go

Copy file name to clipboardExpand all lines: openstack/blockstorage/v3/transfers/requests.go
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ type ListOpts struct {
110110
// ToTransferListQuery formats a ListOpts into a query string.
111111
func (opts ListOpts) ToTransferListQuery() (string, error) {
112112
q, err := gophercloud.BuildQueryString(opts)
113-
return q.String(), err
113+
if err != nil {
114+
return "", nil
115+
}
116+
return q.String(), nil
114117
}
115118

116119
// List returns Transfers optionally limited by the conditions provided in ListOpts.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.