* I had to contextualise Communicator.Start and RemoteCmd.StartWithUi
NOTE: Communicator.Start starts a RemoteCmd but RemoteCmd.StartWithUi will run the cmd and wait for a return, so I renamed StartWithUi to RunWithUi so that the intent is clearer.
Ideally in the future RunWithUi will be named back to StartWithUi and the exit status or wait funcs of the command will allow to wait for a return. If you do so please read carrefully https://golang.org/pkg/os/exec/#Cmd.Stdout to avoid a deadlock
* cmd.ExitStatus to cmd.ExitStatus() is now blocking to avoid race conditions
* also had to simplify StartWithUi
move comments outside of datastructure
remove duplicated section
fix line-endings
Golang doesn't use C-style comments
run gofmt for alignment and whitespace management
remove danling "options" and fix class reference
syncronize tests to new command structure
Previous implementation hardcoded "mkdir -p" which is fine for Unix, but
fails on Windows. This change draws on the example in the chef-solo
provisioner on how to detect the OS in use and use an appropriate mkdir
command.
In addition to updating the mkdir command, the actual executeCommand
needs to be OS specific, since Windows doesn't have sudo and Unix
doesn't require 'SET' when trying to change the value of a variable.
Modify the actual Windows command used to run Puppet.
Since the Facter vars on Windows are set with 'SET <varname>=<value>', a
'&&' is needed between the SET commands and the actual Puppet
invocation.
When puppet is executed in masterless mode it didn't remove
staging directory, this can be a problem because it leaves all
the modules and manifests in the built image.
This is specially problematic when building docker images as they
can be left in the layers unless an specific cleanup is done after
running puppet.
This change adds a flag `clean_staging_directory` to puppet
masterless provisioner so it takes care of this cleanup.
Fixes the following vet report:
provisioner/puppet-masterless/provisioner.go:196: missing argument for Errorf(%d): format reads arg 1, have only 0 args
Prevents the following error,
Build 'amazon-instance' errored: template: tpl11:1:103: executing "tpl11" at <.HieraConfigPath>: HieraConfigPath has arguments but cannot be invoked as function