From 966bc2094efc7a0bb368007312e50795ec1f6c93 Mon Sep 17 00:00:00 2001 From: Alexander Over Date: Thu, 9 Apr 2020 11:46:38 +0200 Subject: [PATCH] add ability to define composer update channel --- REFERENCE.md | 3 +++ manifests/composer.pp | 5 +++++ manifests/composer/auto_update.pp | 10 +++++++--- types/composerchannel.pp | 7 +++++++ 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 types/composerchannel.pp diff --git a/REFERENCE.md b/REFERENCE.md index a82cca46..0d64530d 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -497,6 +497,9 @@ Install composer package manager [*path*] Holds path to the Composer executable +[*channel*] + Holds the Update channel (stable|preview|snapshot|1|2) + [*proxy_type*] proxy server type (none|http|https|ftp) diff --git a/manifests/composer.pp b/manifests/composer.pp index a3c6fdb5..701e5963 100644 --- a/manifests/composer.pp +++ b/manifests/composer.pp @@ -8,6 +8,9 @@ # [*path*] # Holds path to the Composer executable # +# [*channel*] +# Holds the Update channel (stable|preview|snapshot|1|2) +# # [*proxy_type*] # proxy server type (none|http|https|ftp) # @@ -28,6 +31,7 @@ Stdlib::Absolutepath $path = $php::params::composer_path, $proxy_type = undef, $proxy_server = undef, + Php::ComposerChannel $channel = 'stable', Boolean $auto_update = true, Integer $max_age = $php::params::composer_max_age, Variant[Integer, String] $root_group = $php::params::root_group, @@ -52,6 +56,7 @@ max_age => $max_age, source => $source, path => $path, + channel => $channel, proxy_type => $proxy_type, proxy_server => $proxy_server, } diff --git a/manifests/composer/auto_update.pp b/manifests/composer/auto_update.pp index 66f73db2..a182c38c 100644 --- a/manifests/composer/auto_update.pp +++ b/manifests/composer/auto_update.pp @@ -11,6 +11,9 @@ # [*path*] # Holds path to the Composer executable # +# [*channel*] +# Holds the Update channel (stable|preview|snapshot|1|2) +# # [*proxy_type*] # proxy server type (none|http|https|ftp) # @@ -29,8 +32,9 @@ $max_age, $source, $path, - $proxy_type = undef, - $proxy_server = undef, + Php::ComposerChannel $channel = 'stable', + $proxy_type = undef, + $proxy_server = undef, ) { assert_private() @@ -44,7 +48,7 @@ exec { 'update composer': # touch binary when an update is attempted to update its mtime for idempotency when no update is available - command => "${path} --no-interaction --quiet self-update; touch ${path}", + command => "${path} --no-interaction --quiet self-update --${channel}; touch ${path}", environment => $env, onlyif => "test `find '${path}' -mtime +${max_age}`", path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', '/usr/local/sbin' ], diff --git a/types/composerchannel.pp b/types/composerchannel.pp new file mode 100644 index 00000000..00d77ddd --- /dev/null +++ b/types/composerchannel.pp @@ -0,0 +1,7 @@ +type Php::ComposerChannel = Enum[ + 'stable', + 'preview', + 'snapshot', + '1', + '2' # lint:ignore:trailing_comma +]