Skip to content

Commit

Permalink
Added exec_environment variable in tp::dockerize
Browse files Browse the repository at this point in the history
  • Loading branch information
alvagante committed Mar 30, 2016
1 parent 932156b commit 406ef16
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions manifests/dockerize.pp
Expand Up @@ -31,6 +31,8 @@
Boolean $build = false,
Boolean $push = false,

Variant[Undef,Array] $exec_environment = undef,

String $build_options = '',

Boolean $mount_data_dir = true,
Expand Down Expand Up @@ -65,7 +67,7 @@
path => '/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin',
timeout => 3000,
}

# Dockerfile creation
if $create {
exec { "mkdir -p ${basedir_path}":
Expand All @@ -82,14 +84,15 @@
exec { "docker build ${build_options} -t ${username}/${real_repository}:${real_repository_tag} .":
cwd => $basedir_path,
subscribe => File["${basedir_path}/Dockerfile"],
environment => $exec_environment,
}
}

# Image upload to Docker Hub
if $push and $ensure == 'present' {
exec { "docker push ${username}/${real_repository}:${real_repository_tag}":
cwd => $basedir_path,
subscribe => Exec["docker build ${build_options} -t ${username}/${real_repository}:${repository_tag} ."],
subscribe => Exec["docker build ${build_options} -t ${username}/${real_repository}:${real_repository_tag} ."],
environment => $exec_environment,
}
}

Expand All @@ -105,6 +108,10 @@
false => false,
default => $settings[service_enable],
}
exec { "docker pull ${username}/${real_repository}:${real_repository_tag}":
unless => "docker images | grep ${username}/${real_repository} | grep ${real_repository_tag}",
environment => $exec_environment,
}
file { "/etc/init/docker-${app}":
ensure => $ensure,
content => template($init_template),
Expand Down

0 comments on commit 406ef16

Please sign in to comment.