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
6ec428cc
Commit
6ec428cc
authored
Jun 21, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provisioner/shell: retry file delete [GH-2286]
parent
f41429b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
provisioner/shell/provisioner.go
provisioner/shell/provisioner.go
+18
-9
No files found.
provisioner/shell/provisioner.go
View file @
6ec428cc
...
...
@@ -270,16 +270,25 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
return
fmt
.
Errorf
(
"Script exited with non-zero exit status: %d"
,
cmd
.
ExitStatus
)
}
// Delete the temporary file we created
cmd
=
&
packer
.
RemoteCmd
{
Command
:
fmt
.
Sprintf
(
"rm -f %s"
,
p
.
config
.
RemotePath
),
}
if
err
:=
comm
.
Start
(
cmd
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error removing temporary script at %s: %s"
,
p
.
config
.
RemotePath
,
err
)
// Delete the temporary file we created. We retry this a few times
// since if the above rebooted we have to wait until the reboot
// completes.
err
=
p
.
retryable
(
func
()
error
{
cmd
=
&
packer
.
RemoteCmd
{
Command
:
fmt
.
Sprintf
(
"rm -f %s"
,
p
.
config
.
RemotePath
),
}
if
err
:=
comm
.
Start
(
cmd
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error removing temporary script at %s: %s"
,
p
.
config
.
RemotePath
,
err
)
}
cmd
.
Wait
()
return
nil
})
if
err
!=
nil
{
return
err
}
cmd
.
Wait
()
if
cmd
.
ExitStatus
!=
0
{
return
fmt
.
Errorf
(
"Error removing temporary script at %s!"
,
...
...
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