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
56745e14
Commit
56745e14
authored
Jul 16, 2015
by
Chris Bednarski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
manifest_file can now be a folder or file.pp and we will upload it correctly in either case
parent
518ad704
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
16 deletions
+31
-16
provisioner/puppet-masterless/provisioner.go
provisioner/puppet-masterless/provisioner.go
+31
-16
No files found.
provisioner/puppet-masterless/provisioner.go
View file @
56745e14
...
...
@@ -270,28 +270,43 @@ func (p *Provisioner) uploadManifests(ui packer.Ui, comm packer.Communicator) (s
return
""
,
fmt
.
Errorf
(
"Error creating manifests directory: %s"
,
err
)
}
// Upload the main manifest
f
,
err
:=
os
.
Open
(
p
.
config
.
ManifestFile
)
// NOTE! manifest_file may either be a directory or a file, as puppet apply
// now accepts either one.
fi
,
err
:=
os
.
Stat
(
p
.
config
.
ManifestFile
)
if
err
!=
nil
{
return
""
,
err
return
""
,
fmt
.
Errorf
(
"Error inspecting manifest file: %s"
,
err
)
}
defer
f
.
Close
()
manifestFilename
:=
p
.
config
.
ManifestFile
if
fi
,
err
:=
os
.
Stat
(
p
.
config
.
ManifestFile
);
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"Error inspecting manifest file: %s"
,
err
)
}
else
if
!
fi
.
IsDir
()
{
manifestFilename
=
filepath
.
Base
(
manifestFilename
)
if
fi
.
IsDir
()
{
// If manifest_file is a directory we'll upload the whole thing
ui
.
Message
(
fmt
.
Sprintf
(
"Uploading manifest directory from: %s"
,
p
.
config
.
ManifestFile
))
remoteManifestDir
:=
fmt
.
Sprintf
(
"%s/manifests"
,
p
.
config
.
StagingDir
)
err
:=
p
.
uploadDirectory
(
ui
,
comm
,
remoteManifestDir
,
p
.
config
.
ManifestFile
)
if
err
!=
nil
{
return
""
,
fmt
.
Errorf
(
"Error uploading manifest dir: %s"
,
err
)
}
return
remoteManifestDir
,
nil
}
else
{
ui
.
Say
(
"WARNING: manifest_file should be a file. Use manifest_dir for directories"
)
}
// Otherwise manifest_file is a file and we'll upload it
ui
.
Message
(
fmt
.
Sprintf
(
"Uploading manifest file from: %s"
,
p
.
config
.
ManifestFile
))
remoteManifestFile
:=
fmt
.
Sprintf
(
"%s/%s"
,
remoteManifestsPath
,
manifestFilename
)
if
err
:=
comm
.
Upload
(
remoteManifestFile
,
f
,
nil
);
err
!=
nil
{
return
""
,
err
}
f
,
err
:=
os
.
Open
(
p
.
config
.
ManifestFile
)
if
err
!=
nil
{
return
""
,
err
}
defer
f
.
Close
()
return
remoteManifestFile
,
nil
manifestFilename
:=
filepath
.
Base
(
p
.
config
.
ManifestFile
)
remoteManifestFile
:=
fmt
.
Sprintf
(
"%s/%s"
,
remoteManifestsPath
,
manifestFilename
)
if
err
:=
comm
.
Upload
(
remoteManifestFile
,
f
,
nil
);
err
!=
nil
{
return
""
,
err
}
return
remoteManifestFile
,
nil
}
}
func
(
p
*
Provisioner
)
createDir
(
ui
packer
.
Ui
,
comm
packer
.
Communicator
,
dir
string
)
error
{
...
...
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