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
b6d6a71c
Commit
b6d6a71c
authored
Jun 12, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/openstack: wait for more states
parent
48b674d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
builder/openstack/server.go
builder/openstack/server.go
+5
-3
builder/openstack/step_run_source_server.go
builder/openstack/step_run_source_server.go
+3
-3
builder/openstack/step_stop_server.go
builder/openstack/step_stop_server.go
+1
-1
No files found.
builder/openstack/server.go
View file @
b6d6a71c
...
...
@@ -28,7 +28,7 @@ type StateChangeConf struct {
Pending
[]
string
Refresh
StateRefreshFunc
StepState
multistep
.
StateBag
Target
string
Target
[]
string
}
// ServerStateRefreshFunc returns a StateRefreshFunc that is used to watch
...
...
@@ -65,8 +65,10 @@ func WaitForState(conf *StateChangeConf) (i interface{}, err error) {
return
}
if
currentState
==
conf
.
Target
{
return
for
_
,
t
:=
range
conf
.
Target
{
if
currentState
==
t
{
return
}
}
if
conf
.
StepState
!=
nil
{
...
...
builder/openstack/step_run_source_server.go
View file @
b6d6a71c
...
...
@@ -65,7 +65,7 @@ func (s *StepRunSourceServer) Run(state multistep.StateBag) multistep.StepAction
ui
.
Say
(
"Waiting for server to become ready..."
)
stateChange
:=
StateChangeConf
{
Pending
:
[]
string
{
"BUILD"
},
Target
:
"ACTIVE"
,
Target
:
[]
string
{
"ACTIVE"
}
,
Refresh
:
ServerStateRefreshFunc
(
computeClient
,
s
.
server
),
StepState
:
state
,
}
...
...
@@ -105,9 +105,9 @@ func (s *StepRunSourceServer) Cleanup(state multistep.StateBag) {
}
stateChange
:=
StateChangeConf
{
Pending
:
[]
string
{
"ACTIVE"
,
"BUILD"
,
"REBUILD"
,
"SUSPENDED"
},
Pending
:
[]
string
{
"ACTIVE"
,
"BUILD"
,
"REBUILD"
,
"SUSPENDED"
,
"SHUTOFF"
,
"STOPPED"
},
Refresh
:
ServerStateRefreshFunc
(
computeClient
,
s
.
server
),
Target
:
"DELETED"
,
Target
:
[]
string
{
"DELETED"
}
,
}
WaitForState
(
&
stateChange
)
...
...
builder/openstack/step_stop_server.go
View file @
b6d6a71c
...
...
@@ -41,7 +41,7 @@ func (s *StepStopServer) Run(state multistep.StateBag) multistep.StepAction {
ui
.
Message
(
"Waiting for server to stop..."
)
stateChange
:=
StateChangeConf
{
Pending
:
[]
string
{
"ACTIVE"
},
Target
:
"STOPPED"
,
Target
:
[]
string
{
"SHUTOFF"
,
"STOPPED"
}
,
Refresh
:
ServerStateRefreshFunc
(
client
,
server
),
StepState
:
state
,
}
...
...
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