Skip to content

Commit

Permalink
Merge pull request #74 from mprince/issue72
Browse files Browse the repository at this point in the history
Add guest_os_type options for puppet provisioner
  • Loading branch information
mayn committed Oct 17, 2017
2 parents 43665de + ebba443 commit 9d6a51a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/packerlicious/provisioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

from . import BasePackerObject, PackerProperty, EnvVar, TemplateVar, validator

# guest_os_type options for Chef and Puppet
UNIX = "unix"
WINDOWS = "windows"

class PackerProvisioner(BasePackerObject):

Expand Down Expand Up @@ -81,10 +84,6 @@ class ChefClient(PackerProvisioner):
"""
resource_type = "chef-client"

# guest_os_type options
UNIX = "unix"
WINDOWS = "windows"

props = {
'chef_environment': (str, False),
'config_template': (str, False),
Expand Down Expand Up @@ -115,10 +114,6 @@ class ChefSolo(PackerProvisioner):
"""
resource_type = "chef-solo"

# guest_os_type options
UNIX = "unix"
WINDOWS = "windows"

props = {
'chef_environment': (str, False),
'config_template': (str, False),
Expand Down Expand Up @@ -246,8 +241,9 @@ class PuppetMasterless(PackerProvisioner):

props = {
'manifest_file': (str, True),
'extra_arguments': ([str], False),
'execute_command': (str, False),
'extra_arguments': ([str], False),
'guest_os_type': (validator.string_list_item([UNIX, WINDOWS]), False),
'facter': (dict, False),
'hiera_config_path': (str, False),
'ignore_exit_codes': (validator.boolean, False),
Expand All @@ -272,9 +268,11 @@ class PuppetServer(PackerProvisioner):
'client_private_key_path': (str, False),
'execute_command': (str, False),
'facter': (dict, False),
'guest_os_type': (validator.string_list_item([UNIX, WINDOWS]), False),
'ignore_exit_codes': (validator.boolean, False),
'options': (str, False),
'prevent_sudo': (validator.boolean, False),
'puppet_bin_dir': (str, False),
'puppet_node': (str, False),
'puppet_server': (str, False),
'staging_dir': (str, False),
Expand Down
3 changes: 3 additions & 0 deletions tests/packerlicious/test_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ def test_iam_path(self):
for s in ['/%s/' % ('a'*511), '/%s/' % ('a'*1025)]:
with pytest.raises(ValueError):
iam_path(s)
for s in ['%s' % ('a'*5)]:
with pytest.raises(ValueError):
iam_path(s)

def test_iam_role_name(self):
for s in ['a'*30, 'a'*64]:
Expand Down

0 comments on commit 9d6a51a

Please sign in to comment.