diff --git a/manifests/config.pp b/manifests/config.pp index e81e65f..fb98462 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -11,12 +11,14 @@ group => $aptly::group, } + $config = deep_merge($aptly::properties, $aptly::params::properties) + file { $aptly::config_filepath: ensure => file, - content => template('aptly/aptly.conf.erb'), + content => to_json_pretty($config), } - file { $aptly::root_dir: + file { $config['rootDir']: ensure => directory, mode => '0644', recurse => $aptly::recurse_root_dir, diff --git a/manifests/init.pp b/manifests/init.pp index c7d25cd..9551f3b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,13 +19,7 @@ $uid = $aptly::params::uid, $group = $aptly::params::group, $gid = $aptly::params::gid, - $root_dir = $aptly::params::root_dir, - $architectures = $aptly::params::architectures, - $ppa_dist = $aptly::params::ppa_dist, - $ppa_codename = $aptly::params::ppa_codename, $properties = $aptly::params::properties, - $s3_publish_endpoints = $aptly::params::s3_publish_endpoints, - $swift_publish_endpoints = $aptly::params::swift_publish_endpoints, $enable_api = $aptly::params::enable_api, $api_port = $aptly::params::api_port, $api_bind = $aptly::params::api_bind, @@ -44,8 +38,7 @@ $repo_keyserver, $config_filepath, $user, - $group, - $root_dir) + $group) if ! is_integer($uid) { fail("invalid ${uid} provided") } if ! is_integer($gid) { fail("invalid ${gid} provided") } validate_re($repo_key, '^[A-F0-9]+$') @@ -55,10 +48,7 @@ $enable_api, $api_nolock, $recurse_root_dir) - validate_array($architectures) validate_hash($properties) - validate_hash($s3_publish_endpoints) - validate_hash($swift_publish_endpoints) validate_integer($port, 49150) validate_integer($api_port, 49150) validate_re( diff --git a/manifests/params.pp b/manifests/params.pp index d2f73ad..10a67e1 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -20,23 +20,14 @@ $uid = 450 $group = 'aptly' $gid = 450 - $root_dir = '/var/aptly' - $architectures = [$::architecture] - $ppa_dist = 'ubuntu' - $ppa_codename = '' $properties = { - 'downloadConcurrency' => 4, - 'downloadSpeedLimit' => 0, - 'dependencyFollowSuggests' => false, - 'dependencyFollowRecommends' => false, - 'dependencyFollowAllVariants' => false, - 'dependencyFollowSource' => false, - 'gpgDisableSign' => false, - 'gpgDisableVerify' => false, - 'downloadSourcePackages' => false, - } - $s3_publish_endpoints = {} - $swift_publish_endpoints = {} + 'rootDir' => '/var/aptly', + 'architectures' => [$::architecture], + 'ppaDistributorID' => 'ubuntu', + 'ppaCodename' => '', + 'S3PublishEndpoints' => {}, + 'SwiftPublishEndpoints' => {}, + } $enable_api = false $api_port = 8081 $api_bind = '0.0.0.0' diff --git a/metadata.json b/metadata.json index 89d8147..931a0c2 100644 --- a/metadata.json +++ b/metadata.json @@ -25,7 +25,7 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 4.0.0 < 5.0.0" + "version_requirement": ">= 4.24.0 < 5.0.0" }, { "name": "puppetlabs/apt", diff --git a/templates/aptly.conf.erb b/templates/aptly.conf.erb index 5026c14..f9c8fd8 100644 --- a/templates/aptly.conf.erb +++ b/templates/aptly.conf.erb @@ -1,9 +1,7 @@ { "rootDir": "<%= scope.lookupvar('aptly::root_dir') -%>", "architectures": ["<%= scope.lookupvar('aptly::architectures').join('", "') %>"], -<% scope.lookupvar('aptly::properties').each do |k, v| -%> - "<%= k -%>": <%= v %>, -<% end -%> +<%= scope.lookupvar('aptly::properties').to_pson -%>, "ppaDistributorID": "<%= scope.lookupvar('aptly::ppa_dist') %>", "ppaCodename": "<%= scope.lookupvar('aptly::ppa_codename') %>", "S3PublishEndpoints": <%= scope.lookupvar('aptly::s3_publish_endpoints').to_pson %>,