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
b6ae00fc
Commit
b6ae00fc
authored
Sep 08, 2014
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'rasa-1064-fix-upload-file-permissions'
parents
351ef8bf
75395af1
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
83 additions
and
51 deletions
+83
-51
builder/amazon/chroot/communicator.go
builder/amazon/chroot/communicator.go
+1
-1
builder/amazon/instance/step_upload_x509_cert.go
builder/amazon/instance/step_upload_x509_cert.go
+1
-1
builder/docker/communicator.go
builder/docker/communicator.go
+1
-1
builder/parallels/common/step_upload_parallels_tools.go
builder/parallels/common/step_upload_parallels_tools.go
+1
-1
builder/parallels/common/step_upload_version.go
builder/parallels/common/step_upload_version.go
+1
-1
builder/virtualbox/common/step_upload_guest_additions.go
builder/virtualbox/common/step_upload_guest_additions.go
+1
-1
builder/virtualbox/common/step_upload_version.go
builder/virtualbox/common/step_upload_version.go
+1
-1
builder/vmware/common/step_upload_tools.go
builder/vmware/common/step_upload_tools.go
+1
-1
builder/vmware/iso/driver_esx5.go
builder/vmware/iso/driver_esx5.go
+1
-1
communicator/ssh/communicator.go
communicator/ssh/communicator.go
+49
-25
packer/communicator.go
packer/communicator.go
+2
-1
packer/communicator_mock.go
packer/communicator_mock.go
+2
-1
packer/rpc/communicator.go
packer/rpc/communicator.go
+3
-2
packer/rpc/communicator_test.go
packer/rpc/communicator_test.go
+1
-1
provisioner/ansible-local/provisioner.go
provisioner/ansible-local/provisioner.go
+1
-1
provisioner/chef-client/provisioner.go
provisioner/chef-client/provisioner.go
+3
-3
provisioner/chef-solo/provisioner.go
provisioner/chef-solo/provisioner.go
+3
-3
provisioner/file/provisioner.go
provisioner/file/provisioner.go
+6
-1
provisioner/puppet-masterless/provisioner.go
provisioner/puppet-masterless/provisioner.go
+2
-2
provisioner/salt-masterless/provisioner.go
provisioner/salt-masterless/provisioner.go
+1
-1
provisioner/shell/provisioner.go
provisioner/shell/provisioner.go
+1
-1
No files found.
builder/amazon/chroot/communicator.go
View file @
b6ae00fc
...
...
@@ -60,7 +60,7 @@ func (c *Communicator) Start(cmd *packer.RemoteCmd) error {
return
nil
}
func
(
c
*
Communicator
)
Upload
(
dst
string
,
r
io
.
Reader
)
error
{
func
(
c
*
Communicator
)
Upload
(
dst
string
,
r
io
.
Reader
,
fi
*
os
.
FileInfo
)
error
{
dst
=
filepath
.
Join
(
c
.
Chroot
,
dst
)
log
.
Printf
(
"Uploading to chroot dir: %s"
,
dst
)
tf
,
err
:=
ioutil
.
TempFile
(
""
,
"packer-amazon-chroot"
)
...
...
builder/amazon/instance/step_upload_x509_cert.go
View file @
b6ae00fc
...
...
@@ -45,5 +45,5 @@ func (s *StepUploadX509Cert) uploadSingle(comm packer.Communicator, dst, src str
}
defer
f
.
Close
()
return
comm
.
Upload
(
dst
,
f
)
return
comm
.
Upload
(
dst
,
f
,
nil
)
}
builder/docker/communicator.go
View file @
b6ae00fc
...
...
@@ -57,7 +57,7 @@ func (c *Communicator) Start(remote *packer.RemoteCmd) error {
return
nil
}
func
(
c
*
Communicator
)
Upload
(
dst
string
,
src
io
.
Reader
)
error
{
func
(
c
*
Communicator
)
Upload
(
dst
string
,
src
io
.
Reader
,
fi
*
os
.
FileInfo
)
error
{
// Create a temporary file to store the upload
tempfile
,
err
:=
ioutil
.
TempFile
(
c
.
HostDir
,
"upload"
)
if
err
!=
nil
{
...
...
builder/parallels/common/step_upload_parallels_tools.go
View file @
b6ae00fc
...
...
@@ -62,7 +62,7 @@ func (s *StepUploadParallelsTools) Run(state multistep.StateBag) multistep.StepA
ui
.
Say
(
fmt
.
Sprintf
(
"Uploading Parallels Tools for '%s' to path: '%s'"
,
s
.
ParallelsToolsFlavor
,
s
.
ParallelsToolsGuestPath
))
if
err
:=
comm
.
Upload
(
s
.
ParallelsToolsGuestPath
,
f
);
err
!=
nil
{
if
err
:=
comm
.
Upload
(
s
.
ParallelsToolsGuestPath
,
f
,
nil
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error uploading Parallels Tools: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
...
...
builder/parallels/common/step_upload_version.go
View file @
b6ae00fc
...
...
@@ -33,7 +33,7 @@ func (s *StepUploadVersion) Run(state multistep.StateBag) multistep.StepAction {
ui
.
Say
(
fmt
.
Sprintf
(
"Uploading Parallels version info (%s)"
,
version
))
var
data
bytes
.
Buffer
data
.
WriteString
(
version
)
if
err
:=
comm
.
Upload
(
s
.
Path
,
&
data
);
err
!=
nil
{
if
err
:=
comm
.
Upload
(
s
.
Path
,
&
data
,
nil
);
err
!=
nil
{
state
.
Put
(
"error"
,
fmt
.
Errorf
(
"Error uploading Parallels version: %s"
,
err
))
return
multistep
.
ActionHalt
}
...
...
builder/virtualbox/common/step_upload_guest_additions.go
View file @
b6ae00fc
...
...
@@ -58,7 +58,7 @@ func (s *StepUploadGuestAdditions) Run(state multistep.StateBag) multistep.StepA
}
ui
.
Say
(
"Uploading VirtualBox guest additions ISO..."
)
if
err
:=
comm
.
Upload
(
s
.
GuestAdditionsPath
,
f
);
err
!=
nil
{
if
err
:=
comm
.
Upload
(
s
.
GuestAdditionsPath
,
f
,
nil
);
err
!=
nil
{
state
.
Put
(
"error"
,
fmt
.
Errorf
(
"Error uploading guest additions: %s"
,
err
))
return
multistep
.
ActionHalt
}
...
...
builder/virtualbox/common/step_upload_version.go
View file @
b6ae00fc
...
...
@@ -33,7 +33,7 @@ func (s *StepUploadVersion) Run(state multistep.StateBag) multistep.StepAction {
ui
.
Say
(
fmt
.
Sprintf
(
"Uploading VirtualBox version info (%s)"
,
version
))
var
data
bytes
.
Buffer
data
.
WriteString
(
version
)
if
err
:=
comm
.
Upload
(
s
.
Path
,
&
data
);
err
!=
nil
{
if
err
:=
comm
.
Upload
(
s
.
Path
,
&
data
,
nil
);
err
!=
nil
{
state
.
Put
(
"error"
,
fmt
.
Errorf
(
"Error uploading VirtualBox version: %s"
,
err
))
return
multistep
.
ActionHalt
}
...
...
builder/vmware/common/step_upload_tools.go
View file @
b6ae00fc
...
...
@@ -55,7 +55,7 @@ func (c *StepUploadTools) Run(state multistep.StateBag) multistep.StepAction {
return
multistep
.
ActionHalt
}
if
err
:=
comm
.
Upload
(
c
.
ToolsUploadPath
,
f
);
err
!=
nil
{
if
err
:=
comm
.
Upload
(
c
.
ToolsUploadPath
,
f
,
nil
);
err
!=
nil
{
err
:=
fmt
.
Errorf
(
"Error uploading VMware Tools: %s"
,
err
)
state
.
Put
(
"error"
,
err
)
ui
.
Error
(
err
.
Error
())
...
...
builder/vmware/iso/driver_esx5.go
View file @
b6ae00fc
...
...
@@ -371,7 +371,7 @@ func (d *ESX5Driver) upload(dst, src string) error {
return
err
}
defer
f
.
Close
()
return
d
.
comm
.
Upload
(
dst
,
f
)
return
d
.
comm
.
Upload
(
dst
,
f
,
nil
)
}
func
(
d
*
ESX5Driver
)
verifyChecksum
(
ctype
string
,
hash
string
,
file
string
)
bool
{
...
...
communicator/ssh/communicator.go
View file @
b6ae00fc
...
...
@@ -119,7 +119,7 @@ func (c *comm) Start(cmd *packer.RemoteCmd) (err error) {
return
}
func
(
c
*
comm
)
Upload
(
path
string
,
input
io
.
Reader
)
error
{
func
(
c
*
comm
)
Upload
(
path
string
,
input
io
.
Reader
,
fi
*
os
.
FileInfo
)
error
{
// The target directory and file for talking the SCP protocol
target_dir
:=
filepath
.
Dir
(
path
)
target_file
:=
filepath
.
Base
(
path
)
...
...
@@ -130,7 +130,7 @@ func (c *comm) Upload(path string, input io.Reader) error {
target_dir
=
filepath
.
ToSlash
(
target_dir
)
scpFunc
:=
func
(
w
io
.
Writer
,
stdoutR
*
bufio
.
Reader
)
error
{
return
scpUploadFile
(
target_file
,
input
,
w
,
stdoutR
)
return
scpUploadFile
(
target_file
,
input
,
w
,
stdoutR
,
fi
)
}
return
c
.
scpSession
(
"scp -vt "
+
target_dir
,
scpFunc
)
...
...
@@ -156,7 +156,11 @@ func (c *comm) UploadDir(dst string, src string, excl []string) error {
if
src
[
len
(
src
)
-
1
]
!=
'/'
{
log
.
Printf
(
"No trailing slash, creating the source directory name"
)
return
scpUploadDirProtocol
(
filepath
.
Base
(
src
),
w
,
r
,
uploadEntries
)
fi
,
err
:=
os
.
Stat
(
src
)
if
err
!=
nil
{
return
err
}
return
scpUploadDirProtocol
(
filepath
.
Base
(
src
),
w
,
r
,
uploadEntries
,
fi
)
}
else
{
// Trailing slash, so only upload the contents
return
uploadEntries
()
...
...
@@ -328,7 +332,7 @@ func checkSCPStatus(r *bufio.Reader) error {
return
nil
}
func
scpUploadFile
(
dst
string
,
src
io
.
Reader
,
w
io
.
Writer
,
r
*
bufio
.
Reader
)
error
{
func
scpUploadFile
(
dst
string
,
src
io
.
Reader
,
w
io
.
Writer
,
r
*
bufio
.
Reader
,
fi
*
os
.
FileInfo
)
error
{
// Create a temporary file where we can copy the contents of the src
// so that we can determine the length, since SCP is length-prefixed.
tf
,
err
:=
ioutil
.
TempFile
(
""
,
"packer-upload"
)
...
...
@@ -338,30 +342,45 @@ func scpUploadFile(dst string, src io.Reader, w io.Writer, r *bufio.Reader) erro
defer
os
.
Remove
(
tf
.
Name
())
defer
tf
.
Close
()
log
.
Println
(
"Copying input data into temporary file so we can read the length"
)
if
_
,
err
:=
io
.
Copy
(
tf
,
src
);
err
!=
nil
{
return
err
}
var
mode
os
.
FileMode
var
size
int64
// Sync the file so that the contents are definitely on disk, then
// read the length of it.
if
err
:=
tf
.
Sync
();
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating temporary file for upload: %s"
,
err
)
}
if
fi
!=
nil
{
mode
=
(
*
fi
)
.
Mode
()
.
Perm
()
size
=
(
*
fi
)
.
Size
()
}
else
{
mode
=
0644
// Seek the file to the beginning so we can re-read all of it
if
_
,
err
:=
tf
.
Seek
(
0
,
0
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating temporary file for upload: %s"
,
err
)
}
log
.
Println
(
"Copying input data into temporary file so we can read the length"
)
if
_
,
err
:=
io
.
Copy
(
tf
,
src
);
err
!=
nil
{
return
err
}
fi
,
err
:=
tf
.
Stat
()
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating temporary file for upload: %s"
,
err
)
// Sync the file so that the contents are definitely on disk, then
// read the length of it.
if
err
:=
tf
.
Sync
();
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating temporary file for upload: %s"
,
err
)
}
// Seek the file to the beginning so we can re-read all of it
if
_
,
err
:=
tf
.
Seek
(
0
,
0
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating temporary file for upload: %s"
,
err
)
}
tfi
,
err
:=
tf
.
Stat
()
if
err
!=
nil
{
return
fmt
.
Errorf
(
"Error creating temporary file for upload: %s"
,
err
)
}
size
=
tfi
.
Size
()
}
// Start the protocol
log
.
Println
(
"Beginning file upload..."
)
fmt
.
Fprintln
(
w
,
"C0644"
,
fi
.
Size
(),
dst
)
perms
:=
fmt
.
Sprintf
(
"C%04o"
,
mode
)
fmt
.
Fprintln
(
w
,
perms
,
size
,
dst
)
if
err
:=
checkSCPStatus
(
r
);
err
!=
nil
{
return
err
}
...
...
@@ -378,9 +397,14 @@ func scpUploadFile(dst string, src io.Reader, w io.Writer, r *bufio.Reader) erro
return
nil
}
func
scpUploadDirProtocol
(
name
string
,
w
io
.
Writer
,
r
*
bufio
.
Reader
,
f
func
()
error
)
error
{
func
scpUploadDirProtocol
(
name
string
,
w
io
.
Writer
,
r
*
bufio
.
Reader
,
f
func
()
error
,
fi
os
.
FileInfo
)
error
{
log
.
Printf
(
"SCP: starting directory upload: %s"
,
name
)
fmt
.
Fprintln
(
w
,
"D0755 0"
,
name
)
mode
:=
fi
.
Mode
()
.
Perm
()
perms
:=
fmt
.
Sprintf
(
"D%04o 0"
,
mode
)
fmt
.
Fprintln
(
w
,
perms
,
name
)
err
:=
checkSCPStatus
(
r
)
if
err
!=
nil
{
return
err
...
...
@@ -430,7 +454,7 @@ func scpUploadDir(root string, fs []os.FileInfo, w io.Writer, r *bufio.Reader) e
err
=
func
()
error
{
defer
f
.
Close
()
return
scpUploadFile
(
fi
.
Name
(),
f
,
w
,
r
)
return
scpUploadFile
(
fi
.
Name
(),
f
,
w
,
r
,
&
fi
)
}()
if
err
!=
nil
{
...
...
@@ -454,7 +478,7 @@ func scpUploadDir(root string, fs []os.FileInfo, w io.Writer, r *bufio.Reader) e
}
return
scpUploadDir
(
realPath
,
entries
,
w
,
r
)
})
}
,
fi
)
if
err
!=
nil
{
return
err
}
...
...
packer/communicator.go
View file @
b6ae00fc
...
...
@@ -3,6 +3,7 @@ package packer
import
(
"github.com/mitchellh/iochan"
"io"
"os"
"strings"
"sync"
)
...
...
@@ -57,7 +58,7 @@ type Communicator interface {
// Upload uploads a file to the machine to the given path with the
// contents coming from the given reader. This method will block until
// it completes.
Upload
(
string
,
io
.
Reader
)
error
Upload
(
string
,
io
.
Reader
,
*
os
.
FileInfo
)
error
// UploadDir uploads the contents of a directory recursively to
// the remote path. It also takes an optional slice of paths to
...
...
packer/communicator_mock.go
View file @
b6ae00fc
...
...
@@ -3,6 +3,7 @@ package packer
import
(
"bytes"
"io"
"os"
"sync"
)
...
...
@@ -68,7 +69,7 @@ func (c *MockCommunicator) Start(rc *RemoteCmd) error {
return
nil
}
func
(
c
*
MockCommunicator
)
Upload
(
path
string
,
r
io
.
Reader
)
error
{
func
(
c
*
MockCommunicator
)
Upload
(
path
string
,
r
io
.
Reader
,
fi
*
os
.
FileInfo
)
error
{
c
.
UploadCalled
=
true
c
.
UploadPath
=
path
...
...
packer/rpc/communicator.go
View file @
b6ae00fc
...
...
@@ -6,6 +6,7 @@ import (
"io"
"log"
"net/rpc"
"os"
)
// An implementation of packer.Communicator where the communicator is actually
...
...
@@ -103,7 +104,7 @@ func (c *communicator) Start(cmd *packer.RemoteCmd) (err error) {
return
}
func
(
c
*
communicator
)
Upload
(
path
string
,
r
io
.
Reader
)
(
err
error
)
{
func
(
c
*
communicator
)
Upload
(
path
string
,
r
io
.
Reader
,
fi
*
os
.
FileInfo
)
(
err
error
)
{
// Pipe the reader through to the connection
streamId
:=
c
.
mux
.
NextId
()
go
serveSingleCopy
(
"uploadData"
,
c
.
mux
,
streamId
,
nil
,
r
)
...
...
@@ -233,7 +234,7 @@ func (c *CommunicatorServer) Upload(args *CommunicatorUploadArgs, reply *interfa
}
defer
readerC
.
Close
()
err
=
c
.
c
.
Upload
(
args
.
Path
,
readerC
)
err
=
c
.
c
.
Upload
(
args
.
Path
,
readerC
,
nil
)
return
}
...
...
packer/rpc/communicator_test.go
View file @
b6ae00fc
...
...
@@ -82,7 +82,7 @@ func TestCommunicatorRPC(t *testing.T) {
defer
uploadW
.
Close
()
uploadW
.
Write
([]
byte
(
"uploadfoo
\n
"
))
}()
err
=
remote
.
Upload
(
"foo"
,
uploadR
)
err
=
remote
.
Upload
(
"foo"
,
uploadR
,
nil
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
}
...
...
provisioner/ansible-local/provisioner.go
View file @
b6ae00fc
...
...
@@ -320,7 +320,7 @@ func (p *Provisioner) uploadFile(ui packer.Ui, comm packer.Communicator, dst, sr
}
defer
f
.
Close
()
if
err
=
comm
.
Upload
(
dst
,
f
);
err
!=
nil
{
if
err
=
comm
.
Upload
(
dst
,
f
,
nil
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error uploading %s: %s"
,
src
,
err
)
}
return
nil
...
...
provisioner/chef-client/provisioner.go
View file @
b6ae00fc
...
...
@@ -295,7 +295,7 @@ func (p *Provisioner) createConfig(ui packer.Ui, comm packer.Communicator, nodeN
}
remotePath
:=
filepath
.
ToSlash
(
filepath
.
Join
(
p
.
config
.
StagingDir
,
"client.rb"
))
if
err
:=
comm
.
Upload
(
remotePath
,
bytes
.
NewReader
([]
byte
(
configString
)));
err
!=
nil
{
if
err
:=
comm
.
Upload
(
remotePath
,
bytes
.
NewReader
([]
byte
(
configString
))
,
nil
);
err
!=
nil
{
return
""
,
err
}
...
...
@@ -324,7 +324,7 @@ func (p *Provisioner) createJson(ui packer.Ui, comm packer.Communicator) (string
// Upload the bytes
remotePath
:=
filepath
.
ToSlash
(
filepath
.
Join
(
p
.
config
.
StagingDir
,
"first-boot.json"
))
if
err
:=
comm
.
Upload
(
remotePath
,
bytes
.
NewReader
(
jsonBytes
));
err
!=
nil
{
if
err
:=
comm
.
Upload
(
remotePath
,
bytes
.
NewReader
(
jsonBytes
)
,
nil
);
err
!=
nil
{
return
""
,
err
}
...
...
@@ -453,7 +453,7 @@ func (p *Provisioner) copyValidationKey(ui packer.Ui, comm packer.Communicator,
}
defer
f
.
Close
()
if
err
:=
comm
.
Upload
(
remotePath
,
f
);
err
!=
nil
{
if
err
:=
comm
.
Upload
(
remotePath
,
f
,
nil
);
err
!=
nil
{
return
err
}
...
...
provisioner/chef-solo/provisioner.go
View file @
b6ae00fc
...
...
@@ -329,7 +329,7 @@ func (p *Provisioner) uploadFile(ui packer.Ui, comm packer.Communicator, dst str
}
defer
f
.
Close
()
return
comm
.
Upload
(
dst
,
f
)
return
comm
.
Upload
(
dst
,
f
,
nil
)
}
func
(
p
*
Provisioner
)
createConfig
(
ui
packer
.
Ui
,
comm
packer
.
Communicator
,
localCookbooks
[]
string
,
rolesPath
string
,
dataBagsPath
string
,
encryptedDataBagSecretPath
string
,
environmentsPath
string
,
chefEnvironment
string
)
(
string
,
error
)
{
...
...
@@ -379,7 +379,7 @@ func (p *Provisioner) createConfig(ui packer.Ui, comm packer.Communicator, local
}
remotePath
:=
filepath
.
ToSlash
(
filepath
.
Join
(
p
.
config
.
StagingDir
,
"solo.rb"
))
if
err
:=
comm
.
Upload
(
remotePath
,
bytes
.
NewReader
([]
byte
(
configString
)));
err
!=
nil
{
if
err
:=
comm
.
Upload
(
remotePath
,
bytes
.
NewReader
([]
byte
(
configString
))
,
nil
);
err
!=
nil
{
return
""
,
err
}
...
...
@@ -408,7 +408,7 @@ func (p *Provisioner) createJson(ui packer.Ui, comm packer.Communicator) (string
// Upload the bytes
remotePath
:=
filepath
.
ToSlash
(
filepath
.
Join
(
p
.
config
.
StagingDir
,
"node.json"
))
if
err
:=
comm
.
Upload
(
remotePath
,
bytes
.
NewReader
(
jsonBytes
));
err
!=
nil
{
if
err
:=
comm
.
Upload
(
remotePath
,
bytes
.
NewReader
(
jsonBytes
)
,
nil
);
err
!=
nil
{
return
""
,
err
}
...
...
provisioner/file/provisioner.go
View file @
b6ae00fc
...
...
@@ -89,7 +89,12 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
}
defer
f
.
Close
()
err
=
comm
.
Upload
(
p
.
config
.
Destination
,
f
)
fi
,
err
:=
f
.
Stat
()
if
err
!=
nil
{
return
err
}
err
=
comm
.
Upload
(
p
.
config
.
Destination
,
f
,
&
fi
)
if
err
!=
nil
{
ui
.
Error
(
fmt
.
Sprintf
(
"Upload failed: %s"
,
err
))
}
...
...
provisioner/puppet-masterless/provisioner.go
View file @
b6ae00fc
...
...
@@ -301,7 +301,7 @@ func (p *Provisioner) uploadHieraConfig(ui packer.Ui, comm packer.Communicator)
defer
f
.
Close
()
path
:=
fmt
.
Sprintf
(
"%s/hiera.yaml"
,
p
.
config
.
StagingDir
)
if
err
:=
comm
.
Upload
(
path
,
f
);
err
!=
nil
{
if
err
:=
comm
.
Upload
(
path
,
f
,
nil
);
err
!=
nil
{
return
""
,
err
}
...
...
@@ -325,7 +325,7 @@ func (p *Provisioner) uploadManifests(ui packer.Ui, comm packer.Communicator) (s
manifestFilename
:=
filepath
.
Base
(
p
.
config
.
ManifestFile
)
remoteManifestFile
:=
fmt
.
Sprintf
(
"%s/%s"
,
remoteManifestsPath
,
manifestFilename
)
if
err
:=
comm
.
Upload
(
remoteManifestFile
,
f
);
err
!=
nil
{
if
err
:=
comm
.
Upload
(
remoteManifestFile
,
f
,
nil
);
err
!=
nil
{
return
""
,
err
}
...
...
provisioner/salt-masterless/provisioner.go
View file @
b6ae00fc
...
...
@@ -203,7 +203,7 @@ func uploadMinionConfig(comm packer.Communicator, dst string, src string) error
}
defer
f
.
Close
()
if
err
=
comm
.
Upload
(
dst
,
f
);
err
!=
nil
{
if
err
=
comm
.
Upload
(
dst
,
f
,
nil
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error uploading minion config: %s"
,
err
)
}
...
...
provisioner/shell/provisioner.go
View file @
b6ae00fc
...
...
@@ -269,7 +269,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
r
=
&
UnixReader
{
Reader
:
r
}
}
if
err
:=
comm
.
Upload
(
p
.
config
.
RemotePath
,
r
);
err
!=
nil
{
if
err
:=
comm
.
Upload
(
p
.
config
.
RemotePath
,
r
,
nil
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error uploading script: %s"
,
err
)
}
...
...
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