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
2dad0cdc
Commit
2dad0cdc
authored
Dec 06, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/amazon/chroot: block when obtaining lock [GH-689]
parent
2385f087
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
7 deletions
+4
-7
CHANGELOG.md
CHANGELOG.md
+2
-0
builder/amazon/chroot/lockfile_unix.go
builder/amazon/chroot/lockfile_unix.go
+1
-6
builder/amazon/chroot/step_flock.go
builder/amazon/chroot/step_flock.go
+1
-1
No files found.
CHANGELOG.md
View file @
2dad0cdc
...
@@ -11,6 +11,8 @@ BUG FIXES:
...
@@ -11,6 +11,8 @@ BUG FIXES:
*
core: Don't change background color on CLI anymore, making things look
*
core: Don't change background color on CLI anymore, making things look
a tad nicer in some terminals.
a tad nicer in some terminals.
*
builder/amazon/chroot: Block when obtaining file lock to allow
parallel builds. [GH-689]
*
builder/vmware: Cleanup of VMX keys works properly so cd-rom won't
*
builder/vmware: Cleanup of VMX keys works properly so cd-rom won't
get stuck with ISO. [GH-685]
get stuck with ISO. [GH-685]
...
...
builder/amazon/chroot/lockfile_unix.go
View file @
2dad0cdc
...
@@ -14,13 +14,8 @@ const LOCK_NB = 4
...
@@ -14,13 +14,8 @@ const LOCK_NB = 4
const
LOCK_UN
=
8
const
LOCK_UN
=
8
func
lockFile
(
f
*
os
.
File
)
error
{
func
lockFile
(
f
*
os
.
File
)
error
{
err
:=
syscall
.
Flock
(
int
(
f
.
Fd
()),
LOCK_EX
|
LOCK_NB
)
err
:=
syscall
.
Flock
(
int
(
f
.
Fd
()),
LOCK_EX
)
if
err
!=
nil
{
if
err
!=
nil
{
errno
,
ok
:=
err
.
(
syscall
.
Errno
)
if
ok
&&
errno
==
syscall
.
EWOULDBLOCK
{
return
errors
.
New
(
"file already locked"
)
}
return
err
return
err
}
}
...
...
builder/amazon/chroot/step_flock.go
View file @
2dad0cdc
...
@@ -39,7 +39,7 @@ func (s *StepFlock) Run(state multistep.StateBag) multistep.StepAction {
...
@@ -39,7 +39,7 @@ func (s *StepFlock) Run(state multistep.StateBag) multistep.StepAction {
// LOCK!
// LOCK!
if
err
:=
lockFile
(
f
);
err
!=
nil
{
if
err
:=
lockFile
(
f
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error
creat
ing lock: %s"
,
err
)
err
:=
fmt
.
Errorf
(
"Error
obtain
ing lock: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
ui
.
Error
(
err
.
Error
())
return
multistep
.
ActionHalt
return
multistep
.
ActionHalt
...
...
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