Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
5d0cd967
Commit
5d0cd967
authored
Jul 01, 2014
by
Ross Smith II
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1307 from lflux/better-serverbyid-fix
Replace ListServers hack with update ServerById
parents
25ff0f04
0da4aa6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
builder/openstack/server.go
builder/openstack/server.go
+10
-13
No files found.
builder/openstack/server.go
View file @
5d0cd967
...
...
@@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"github.com/mitchellh/multistep"
"github.com/racker/perigee"
"github.com/rackspace/gophercloud"
"log"
"time"
...
...
@@ -33,22 +34,18 @@ type StateChangeConf struct {
// an openstack server.
func
ServerStateRefreshFunc
(
csp
gophercloud
.
CloudServersProvider
,
s
*
gophercloud
.
Server
)
StateRefreshFunc
{
return
func
()
(
interface
{},
string
,
int
,
error
)
{
servers
,
err
:=
csp
.
ListServers
(
)
resp
,
err
:=
csp
.
ServerById
(
s
.
Id
)
if
err
!=
nil
{
log
.
Printf
(
"Error on ServerStateRefresh: %s"
,
err
)
return
nil
,
""
,
0
,
err
}
var
resp
*
gophercloud
.
Server
found
:=
false
for
_
,
server
:=
range
servers
{
if
server
.
Id
==
s
.
Id
{
found
=
true
resp
=
&
server
urce
,
ok
:=
err
.
(
*
perigee
.
UnexpectedResponseCodeError
)
if
ok
&&
(
urce
.
Actual
==
404
)
{
log
.
Printf
(
"404 on ServerStateRefresh, returning DELETED"
)
return
nil
,
"DELETED"
,
0
,
nil
}
else
{
log
.
Printf
(
"Error on ServerStateRefresh: %s"
,
err
)
return
nil
,
""
,
0
,
err
}
}
if
found
==
false
{
return
nil
,
"DELETED"
,
0
,
nil
}
return
resp
,
resp
.
Status
,
resp
.
Progress
,
nil
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment