diff --git a/.fixtures.yml b/.fixtures.yml index 14626a1..38e2161 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -4,6 +4,7 @@ fixtures: forge_modules: apt: puppetlabs/apt + archive: puppet/archive concat: puppetlabs/concat cron_core: puppetlabs/cron_core postgresql: puppetlabs/postgresql diff --git a/manifests/repo/apt.pp b/manifests/repo/apt.pp index 0a673f9..8b33e7d 100644 --- a/manifests/repo/apt.pp +++ b/manifests/repo/apt.pp @@ -1,21 +1,31 @@ # @api private -class pgprobackup::repo::apt inherits pgprobackup::repo { +class pgprobackup::repo::apt ( + String $baseurl = 'https://repo.postgrespro.ru/pg_probackup/deb/', + String $arch = 'amd64', +) { include apt - $default_baseurl = 'https://repo.postgrespro.ru/pg_probackup/deb/' - - $_baseurl = pick($pgprobackup::repo::baseurl, $default_baseurl) + $_keyring = '/usr/share/keyrings/pg_probackup.gpg' + $_tmp_gpg = '/tmp/pg_probackup.gpg' + # TODO: Switch to apt::keyring once supported by puppetlabs-apt + # see: https://github.com/puppetlabs/puppetlabs-apt/pull/1128 + archive { $_tmp_gpg: + source => 'https://repo.postgrespro.ru/pg_probackup/keys/GPG-KEY-PG-PROBACKUP', + extract => true, + extract_path => '/usr/share/keyrings', + extract_command => 'gpg --dearmor < %s > pg_probackup.gpg', + creates => $_keyring, + } apt::source { 'pgprobackup': - location => $_baseurl, - release => $facts['os']['distro']['codename'], - repos => "main-${facts['os']['distro']['codename']}", - key => { - id => '473F44A5E663EE574CE74E1FA78979F6636D717E', - source => 'https://repo.postgrespro.ru/pg_probackup/keys/GPG-KEY-PG_PROBACKUP', - }, - include => { + location => $baseurl, + release => $facts['os']['distro']['codename'], + architecture => $arch, + repos => "main-${facts['os']['distro']['codename']}", + include => { src => $pgprobackup::repo::src, }, + keyring => $_keyring, + require => Archive[$_tmp_gpg], } } diff --git a/manifests/repo/yum.pp b/manifests/repo/yum.pp index a4f77ef..f3f1369 100644 --- a/manifests/repo/yum.pp +++ b/manifests/repo/yum.pp @@ -1,5 +1,5 @@ # @api private -class pgprobackup::repo::yum inherits pgprobackup::repo { +class pgprobackup::repo::yum { $_flavor = downcase($facts['os']['name']) $default_baseurl = "https://repo.postgrespro.ru/pg_probackup/keys/pg_probackup-repo-${_flavor}.noarch.rpm" diff --git a/metadata.json b/metadata.json index da60405..d86a879 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "deric-pgprobackup", - "version": "1.1.0", + "version": "1.2.0", "author": "deric", "summary": "Manage PostgreSQL database backups using pg_probackup tool", "license": "Apache-2.0", @@ -10,6 +10,10 @@ "name": "puppetlabs/apt", "version_requirement": ">= 2.0.0 < 10.0.0" }, + { + "name": "puppet/archive", + "version_requirement": ">= 0.5.1 < 8.0.0" + }, { "name": "puppetlabs/cron_core", "version_requirement": "> 1.0.0 < 2.0.0"