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
a755be49
Commit
a755be49
authored
Aug 28, 2013
by
Rachid Belaid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add doc and change pillar tree in roots to respect salt vocabulary
parent
7bdb5f9c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
13 deletions
+17
-13
provisioner/salt-masterless/provisioner.go
provisioner/salt-masterless/provisioner.go
+10
-10
provisioner/salt-masterless/provisioner_test.go
provisioner/salt-masterless/provisioner_test.go
+3
-3
website/source/docs/provisioners/salt-masterless.html.markdown
...te/source/docs/provisioners/salt-masterless.html.markdown
+4
-0
No files found.
provisioner/salt-masterless/provisioner.go
View file @
a755be49
...
...
@@ -27,8 +27,8 @@ type Config struct {
// Local path to the salt state tree
LocalStateTree
string
`mapstructure:"local_state_tree"`
// Local path to the salt pillar
tree
LocalPillar
Tree
string
`mapstructure:"local_pillar_tree
"`
// Local path to the salt pillar
roots
LocalPillar
Roots
string
`mapstructure:"local_pillar_roots
"`
// Where files will be copied before moving to the /srv/salt directory
TempConfigDir
string
`mapstructure:"temp_config_dir"`
...
...
@@ -63,7 +63,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
"bootstrap_args"
:
&
p
.
config
.
BootstrapArgs
,
"minion_config"
:
&
p
.
config
.
MinionConfig
,
"local_state_tree"
:
&
p
.
config
.
LocalStateTree
,
"local_pillar_
tree"
:
&
p
.
config
.
LocalPillarTree
,
"local_pillar_
roots"
:
&
p
.
config
.
LocalPillarRoots
,
"temp_config_dir"
:
&
p
.
config
.
TempConfigDir
,
}
...
...
@@ -83,10 +83,10 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
}
}
if
p
.
config
.
LocalPillar
Tree
!=
""
{
if
_
,
err
:=
os
.
Stat
(
p
.
config
.
LocalPillar
Tree
);
err
!=
nil
{
if
p
.
config
.
LocalPillar
Roots
!=
""
{
if
_
,
err
:=
os
.
Stat
(
p
.
config
.
LocalPillar
Roots
);
err
!=
nil
{
errs
=
packer
.
MultiErrorAppend
(
errs
,
errors
.
New
(
"local_pillar_
tree
must exist and be accessible"
))
errors
.
New
(
"local_pillar_
roots
must exist and be accessible"
))
}
}
...
...
@@ -155,7 +155,7 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
return
fmt
.
Errorf
(
"Unable to move %s/states to /srv/salt: %d"
,
p
.
config
.
TempConfigDir
,
err
)
}
if
p
.
config
.
LocalPillar
Tree
!=
""
{
if
p
.
config
.
LocalPillar
Roots
!=
""
{
ui
.
Message
(
fmt
.
Sprintf
(
"Creating remote pillar directory: %s/pillar"
,
p
.
config
.
TempConfigDir
))
cmd
:=
&
packer
.
RemoteCmd
{
Command
:
fmt
.
Sprintf
(
"mkdir -p %s/pillar"
,
p
.
config
.
TempConfigDir
)}
...
...
@@ -167,9 +167,9 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
return
fmt
.
Errorf
(
"Error creating remote pillar directory: %s"
,
err
)
}
ui
.
Message
(
fmt
.
Sprintf
(
"Uploading local pillar
tree: %s"
,
p
.
config
.
LocalPillarTree
))
if
err
=
UploadLocalDirectory
(
p
.
config
.
LocalPillar
Tree
,
fmt
.
Sprintf
(
"%s/pillar"
,
p
.
config
.
TempConfigDir
),
comm
,
ui
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error uploading local pillar
tree
to remote: %s"
,
err
)
ui
.
Message
(
fmt
.
Sprintf
(
"Uploading local pillar
roots: %s"
,
p
.
config
.
LocalPillarRoots
))
if
err
=
UploadLocalDirectory
(
p
.
config
.
LocalPillar
Roots
,
fmt
.
Sprintf
(
"%s/pillar"
,
p
.
config
.
TempConfigDir
),
comm
,
ui
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error uploading local pillar
roots
to remote: %s"
,
err
)
}
ui
.
Message
(
fmt
.
Sprintf
(
"Moving %s/pillar to /srv/pillar"
,
p
.
config
.
TempConfigDir
))
...
...
provisioner/salt-masterless/provisioner_test.go
View file @
a755be49
...
...
@@ -87,17 +87,17 @@ func TestProvisionerPrepare_LocalStateTree(t *testing.T) {
}
}
func
TestProvisionerPrepare_LocalPillar
Tree
(
t
*
testing
.
T
)
{
func
TestProvisionerPrepare_LocalPillar
Roots
(
t
*
testing
.
T
)
{
var
p
Provisioner
config
:=
testConfig
()
config
[
"local_pillar_
tree
"
]
=
"/i/dont/exist/i/think"
config
[
"local_pillar_
roots
"
]
=
"/i/dont/exist/i/think"
err
:=
p
.
Prepare
(
config
)
if
err
==
nil
{
t
.
Fatal
(
"should have error"
)
}
config
[
"local_pillar_
tree
"
]
=
os
.
TempDir
()
config
[
"local_pillar_
roots
"
]
=
os
.
TempDir
()
err
=
p
.
Prepare
(
config
)
if
err
!=
nil
{
t
.
Fatalf
(
"err: %s"
,
err
)
...
...
website/source/docs/provisioners/salt-masterless.html.markdown
View file @
a755be49
...
...
@@ -30,6 +30,10 @@ Optional:
[
state tree
](
http://docs.saltstack.com/ref/states/highstate.html#the-salt-state-tree
)
.
This will be uploaded to the
`/srv/salt`
on the remote.
*
`local_pillar_roots`
(string) - The path to your local
[
pillar roots
](
http://docs.saltstack.com/ref/configuration/master.html#pillar-configuration
)
.
This will be uploaded to the
`/srv/pillar`
on the remote.
*
`skip_bootstrap`
(boolean) - By default the salt provisioner runs
[
salt bootstrap
](
https://github.com/saltstack/salt-bootstrap
)
to install
salt. Set this to true to skip this step.
...
...
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