Commit Graph

584 Commits

Author SHA1 Message Date
DanHam fa5fd602aa Fix tests post changes 2017-09-26 11:07:26 +01:00
DanHam 8214a12a2a Move append of portion of command used to send elevated PS output to file 2017-09-26 11:07:26 +01:00
DanHam 2a060adbf8 Don't use -EncodedCommand with PS as progress stream always leaks to stderr
* Setting $ProgressPreference to SilentlyContinue makes no difference
  when -EncodedCommand is used - any output to the progress stream
  still appears on stderr.
* Delete file containing encode/decode functions since we no longer
  need them.
* Fixes leak of output on progress streams for both normal and elevated
  commands.
* Since we no longer base64 encode, ensure any characters special to XML
  are correctly escaped in the elevated command. This ensures correct
  parsing once the command is wrapped within the elevatedTemplates XML
  based Task Scheduler definition.

Fixes #4322
2017-09-26 11:07:11 +01:00
Matthew Hooker 2297cfaee2 Merge pull request #5357 from lochnesh/fix-windows-chef-solo-version
use flag -version instead of -v to install chef-solo on Windows
2017-09-25 18:18:16 -05:00
DanHam 5374c6e367
Use system context env var to set path for elevated PS env vars file 2017-09-21 12:08:29 +01:00
Skyler Nesheim 52d3137b08 use flag -version instead of -v to install chef-solo on Windows 2017-09-18 09:43:02 -05:00
Matthew Hooker 70e493a2c2
fix directory permissions when using sudo 2017-09-15 10:48:50 -07:00
Matthew Hooker af1187d5e1
simplify a bit 2017-09-15 10:06:54 -07:00
Megan Marsh b05c673a14 Update powershell provisioner test with new default 2017-09-15 08:17:17 -07:00
Megan Marsh cbe1d7d854 simplify file upload for elevated powershell wrapper 2017-09-14 17:01:48 -07:00
Megan Marsh 92e70757bb Move env vars into a file that we dot-source instead of trying to write them all to the command line 2017-09-14 17:00:57 -07:00
Megan Marsh d458628529 exclude elevated_executed_command from config interpolation so it can be used correctly later 2017-09-14 10:50:32 -07:00
c22 948f955758 Fix regression bug reported in #5339 2017-09-14 11:44:14 +10:00
c22 cb12cd6668 Fix facterVar separator bug reported in #5338 2017-09-14 11:35:54 +10:00
Megan Marsh c6889ad009 clarify logging by changing 'shell' to 'powershell' inside of the powershell provisioner 2017-09-06 11:59:25 -07:00
Megan Marsh 959db1ac16 add echo test to winrm connection. 2017-09-01 15:26:41 -07:00
Matthew Hooker 54920422ea Merge pull request #5252 from c22/packer_4391_rework
#4391 rework (see #4426)
2017-08-31 13:46:48 -07:00
Megan Marsh f15304aa59 Merge pull request #5272 from hashicorp/fix_5064
Fix post-restart powershell failure
2017-08-28 11:41:37 -07:00
Megan Marsh 401c718a59 set default for ExpectDisconnect to false 2017-08-24 14:46:52 -07:00
Megan Marsh b1001264ed fix windows-restart tests 2017-08-24 14:30:15 -07:00
Megan Marsh b2923b4da6 check stdout to make sure echo command actually goes through before counting computer as fully restarted 2017-08-24 12:10:27 -07:00
Megan Marsh 89b058604d update tests for pull 5272 2017-08-22 14:20:40 -07:00
Megan Marsh 5214851463 make every script name unique 2017-08-22 14:03:28 -07:00
c22 42f1aa7a95 Refactor puppet-masterless based on puppet-server 2017-08-22 14:10:37 +10:00
c22 bc2e3de06d Resolve merge conflicts and update documentation. 2017-08-22 14:10:37 +10:00
c22 80ba99c04f Update documentation + small fixes
Updated the puppet-masterless documentation
Removed extraneous ConfigTemplate code
2017-08-22 14:10:37 +10:00
c22 fbac46af91 Linting + formatting 2017-08-22 14:10:37 +10:00
Sam Kerr bcd30ad2f2 Update puppet-masterless commands to be OS specific
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.
2017-08-22 14:10:37 +10:00
c22 1c592f291e Better Windows support in puppet-server
Reworking the puppet-server provisioner based on chef-client.
2017-08-22 14:10:37 +10:00
Brett Russ 7192c46e46 sudo prefix the command which cleans up `/srv/{salt,pillar}` as these are created with sudo in the packer driven salt bootstrapper 2017-08-11 21:26:16 -04:00
Luke Farnell d9a5b69403 clean up ineffectual assignments 2017-08-07 13:20:01 -04:00
Matthew Hooker b1f06bbebb
fix wording 2017-06-26 12:56:55 -07:00
Matthew Hooker 56979a1974
Revert "Universally provide POSIX semantics for the `shell` provisioner."
This reverts commit 1ba7f9cc20.
2017-06-21 16:11:47 -07:00
Matthew Hooker 67e29e1eff
disambiguates windows-restart messages. 2017-06-21 10:51:23 -07:00
Matthew Hooker 11379dea70 Merge pull request #5009 from sjlamerton/salt_bin_dir
Add support for salt_bin_dir
2017-06-13 10:21:53 -07:00
Matthew Hooker 8f685b3bcd
ansible: add skip_version_check flag 2017-06-07 13:31:56 -07:00
Matthew Hooker 70b3d05fb3 Merge pull request #4760 from fajpunk/ansible-inventory-dir
inventory_directory option for ansible provisioner
2017-06-07 11:22:23 -07:00
Steven Lamerton e953898890 Add support for salt_bin_dir
Allows specifying the path to salt-call, useful if it isn't on the
path.
2017-06-07 08:16:23 +01:00
Matthew Hooker bc16c13b50 Merge pull request #4961 from magicalbob/grains
Grains
2017-06-06 12:37:18 -07:00
Matthew Hooker 74bf0b636b Merge pull request #4791 from optix2000/master
Add version selection for chef-solo provisioner
2017-06-05 15:30:48 -07:00
Ian Ellis 31f66b6fe9 Cloned GrainsFile test from MinionConfig test 2017-06-04 13:03:50 +01:00
Ian Ellis 912fc9c2af Added grains_file config item to copy file to /etc/salt/grains 2017-06-04 08:31:30 +01:00
Sean Chittenden 1ba7f9cc20
Universally provide POSIX semantics for the `shell` provisioner.
All platforms everywhere have `env(1)` available, leverage it
accordingly.

Improves on: #2343
2017-05-20 09:28:02 -07:00
Matthew Hooker 7999f886b1 Merge pull request #4792 from mkuzmin/slash
provisioner/ansible-local: Convert Windows paths with backslashes to …
2017-04-26 15:20:49 -07:00
Dan Fuchs 8401057ed5 Merge branch 'master' into ansible-inventory-dir 2017-04-26 13:20:00 -05:00
Rickard von Essen 999f2da499
ansible-local/ansible: Add extra-vars packer_*
Added:
- `packer_build_name`
- `packer_builder_type`
- `packer_http_addr` - `ansible-local` only

Closes: #4820
2017-04-23 12:55:01 +02:00
Dan Fuchs 97c819dc15 Merge branch 'master' of https://github.com/mitchellh/packer into ansible-inventory-dir 2017-04-20 10:34:03 -05:00
Weilu Jia b1c5ccd3e2 Add version selection for chef-solo provisioner in Windows too 2017-04-17 18:16:34 -07:00
Michael Kuzmin 795921988e provisioner/ansible-local: Convert Windows paths with backslashes to Unix style 2017-04-13 12:15:00 +03:00
Weilu Jia c418307162 Add version selection for chef-solo provisioner
Prevents issues such as #1751 when chef changes major versions
2017-04-12 16:18:00 -07:00
Dan Fuchs f45f4568db make validateInventoryDirectoryConfig function 2017-04-06 14:50:02 -05:00
Dan Fuchs 39a9eac44f Remove `req` param from validateDirectoryConfig 2017-04-05 09:14:30 -05:00
Dan Fuchs 3fc809c05b Ansible provisioner: check if inventory directory exists during prepare 2017-04-04 22:49:24 -05:00
Dan Fuchs 492bff474b Ansible provisioner: Specify full path to generated inventory file 2017-04-04 22:04:26 -05:00
Dan Fuchs 609e70face inventory_directory option for ansible provisioner
Add an `inventory_directory` setting to the Ansible provisioner that
allows a user to specify a directory in which the Packer Ansible
provisioner would write the generated inventory file.  If a value is
specified for this setting, then have the Packer Ansible provisioner
pass this directory as the -i arg when it calls ansible.

This would allow an Ansible playbook used by the Packer Ansible
provisioner to use variables specified in `host_vars` and `group_vars`
in this inventory directory.
2017-04-04 16:43:46 -05:00
Matthew Hooker 81522dced0
move packer to hashicorp 2017-04-04 13:39:01 -07:00
Matthew Hooker 6f27f67346
more fixes from errcheck 2017-03-29 13:38:31 -07:00
Matthew Hooker de296ac06b
simplify 2017-03-28 20:45:25 -07:00
Matthew Hooker 35578d9ed1
remove unnecessary type conversions 2017-03-28 20:36:21 -07:00
Matthew Hooker 79287d7e47
simplify some code 2017-03-28 20:36:20 -07:00
Matthew Hooker 0149f679de
Print instead of Printf with no dynamic first variable. 2017-03-28 20:36:20 -07:00
Matthew Hooker d1b20b3d9c
remove a bunch of dead code.
https://github.com/dominikh/go-tools/tree/master/cmd/unused
2017-03-28 20:36:20 -07:00
Matthew Hooker 230079f73a
spell fixes 2017-03-28 20:36:19 -07:00
Andrey Chernih 7548024720 More verbose error message when ansible-playbook fails
I've spent 1 hour today debugging why packer does not want to work with
ansible. It turns out `ansible-playbook` command was returning non-zero
exit status because of the file system permission problem.

Output before change:

    % packer build rabbitmq.json
    amazon-ebs output will be in this color.

    1 error(s) occurred:

    * exit status 1

Output after change:

    amazon-ebs output will be in this color.

    1 error(s) occurred:

    * Error running "ansible-playbook --version": exit status 1
2017-03-21 20:26:41 -07:00
Matthew Hooker 6894f93085 Merge pull request #4534 from mitchellh/chefclean
provisioner/chef-client: only upload knife config if we're cleaning
2017-02-26 18:46:15 -08:00
Marc Carmier 78ab21b42f Test error messages for restart_command and restart_timeout seems to be erroneous 2017-02-12 18:17:31 +01:00
Matthew Hooker 825f69c64d
provisioner/chef-client: only upload knife config if we're cleaning 2017-02-09 23:37:35 -08:00
Matthew Hooker a836268490
fix test on windows 2017-02-06 11:29:39 -08:00
Matthew Hooker 0f445dff07
fix tests 2017-02-03 15:03:19 -08:00
Matthew Hooker 45030e1919
provisioner/anisble: use randomized staging dir 2017-01-27 16:14:35 -08:00
DanHam 370b67497e
provisioner/powershell: Don't over complicate removal of tmp output file 2017-01-26 11:21:45 +00:00
DanHam 21be983855 provisioner/powershell: Use system context env var to set output file path
Fixes #4271
2017-01-26 00:17:46 +00:00
DanHam e350739ecb
post-processor/shell-local: expand tests to align with shell provisioner 2017-01-23 22:25:39 +00:00
DanHam 28051a9218 provisioner/windows-shell: fix and compact env var test 2017-01-23 12:10:46 +00:00
DanHam e8db6b9b9a provisioner/windows-shell: Remove env var check - again checked in prepare 2017-01-23 12:10:46 +00:00
DanHam c88fafdf38 provisioner/powershell: align, fix and compact env var test 2017-01-23 12:10:46 +00:00
DanHam 4122f3a897 provisioner/powershell: Remove env var check - we already check in Prepare 2017-01-23 12:10:46 +00:00
DanHam 4514b1b10f provisioner/shell: expand tests to align with powershell/win-shell 2017-01-23 12:10:46 +00:00
DanHam 0cbb4ff30c provisioner/shell: Align gen of flattened env vars with powershell/win-shell
* Move code to generate quoted flattened env vars to separate function
* Fix: generate flattened env vars once per provisioner not once per script
2017-01-23 12:10:46 +00:00
DanHam 80ebcea5e1
Mirror cleaner test code back from windows-shell to powershell 2017-01-19 13:33:59 +00:00
DanHam 2bd9fa6c70
Use counter for index. Sort stray comments. 2017-01-19 12:12:00 +00:00
Matthew Hooker c33cef9c12
tests for equals in windows-shell 2017-01-18 12:51:14 -08:00
DanHam 49bc2e353f
Fix to allow equals in value of environment variable. Mirrors #4328 2017-01-18 12:42:25 -08:00
Matthew Hooker 4e6a44f5f1
append will resize 2017-01-17 17:21:14 -08:00
Matthew Hooker 480398c3d2
only set PACKER_HTTP_ADDR if a server is listening 2017-01-17 17:17:36 -08:00
Matthew Hooker 6563eb213c
Document. add to windows-shell and powershell 2017-01-17 17:07:36 -08:00
Matthew Hooker d2e59e4e92
set PACKER_HTTP_ADDR env var when available.
If using a builder that has an http server set up for file transfer,
expose the connection info to the shell provisioner through the environment
variable PACKER_HTTP_ADDR.

Closes #2869
2017-01-16 23:19:52 -08:00
Matthew Hooker 5fc6a2ee70 Merge pull request #4326 from asteris-llc/feature/converge-provisioner
New Provisioner: Converge
2017-01-04 10:46:18 -08:00
Matthew Hooker 6d6c7864b4 Merge pull request #4328 from DanHam/gh-3108
Allow equals sign in value of environment variable for Powershell provisioner
2017-01-03 12:38:17 -08:00
Sean Malloy a617884a16 Add more tests for puppet-masterless provisioner
* Add tests for staging_directory config option
* Add tests for working_directory config option
2016-12-28 21:14:17 -06:00
Brian Hicks feab6f096e
provisioner(converge): add prevent_bootstrap_sudo 2016-12-28 12:53:22 -06:00
Brian Hicks fb6a5c5bbc
provisioner(converge): change skip_bootstrap back to bootstrap 2016-12-28 12:49:40 -06:00
Brian Hicks 64ebd3af8d
provisioner(converge): remove version validation 2016-12-28 08:49:08 -06:00
Brian Hicks 18425c45d0
provisioner(converge): change bootstrap to skip_bootstrap 2016-12-28 08:48:02 -06:00
Brian Hicks 5d935767f0
provisioner(converge): add bootstrap_command 2016-12-28 08:45:19 -06:00
Brian Hicks 843731d98d
provisioner(converge): add prevent_sudo 2016-12-28 08:19:03 -06:00
Sean Malloy c226b19d08 Add additional unit tests for puppet-server provisioner
* Add puppet-server test for staging_dir config option
* Add puppet-server test for execute_command config option
2016-12-27 22:35:13 -06:00
DanHam 0423f91037
Fix to allow equals sign in value of environment variable 2016-12-28 00:33:16 +00:00
DanHam be0196492f
Tests for env variables values starting with or containing an equals sign 2016-12-28 00:31:17 +00:00
Brian Hicks 3311d3a48d
provisioner(converge): interpolate execute_command 2016-12-27 16:48:11 -06:00