diff options
author | varac <varacanero@zeromail.org> | 2017-05-09 19:24:17 +0200 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2017-05-09 19:24:17 +0200 |
commit | 6f7c01b9ac208bd85b0fc37b822a8ac63750ac6f (patch) | |
tree | 892b8528802980abe16feb19da9054773e2987fe /files/puppet | |
parent | 5dd10513e7273926f466a47faecb37e6edc10ef5 (diff) |
git subrepo clone --force https://github.com/pixelated/puppet-pixelated.git files/puppet/modules/pixelated
subrepo:
subdir: "files/puppet/modules/pixelated"
merged: "ec289de"
upstream:
origin: "https://github.com/pixelated/puppet-pixelated.git"
branch: "master"
commit: "ec289de"
git-subrepo:
version: "0.3.1"
origin: "https://github.com/ingydotnet/git-subrepo.git"
commit: "3202adb"
Diffstat (limited to 'files/puppet')
9 files changed, 62 insertions, 208 deletions
diff --git a/files/puppet/modules/pixelated/.gitrepo b/files/puppet/modules/pixelated/.gitrepo index 2f0672a..4e8dd8b 100644 --- a/files/puppet/modules/pixelated/.gitrepo +++ b/files/puppet/modules/pixelated/.gitrepo @@ -6,6 +6,6 @@ [subrepo] remote = https://github.com/pixelated/puppet-pixelated.git branch = master - commit = 6dc72f4c096d1b40b0e599b962e306f48b4654c5 - parent = d46074423179768632f8f786281c4870b6fb4e0e + commit = ec289deff5c4c466560699bc261481fe68cab605 + parent = 5dd10513e7273926f466a47faecb37e6edc10ef5 cmdver = 0.3.1 diff --git a/files/puppet/modules/pixelated/files/prefer_package_repo.sh b/files/puppet/modules/pixelated/files/prefer_package_repo.sh deleted file mode 100755 index a0d4c43..0000000 --- a/files/puppet/modules/pixelated/files/prefer_package_repo.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash - -# Makes sure that all packages that are available from both LEAP and -# Pixelated debian repos are instaled from Pixelated -# Background is that under certain circumstances Pixelated providers end -# up with some of these packages installed from the LEAP debian repo, and -# even we pin all Pixelated packages with '1000' in `/etc/apt/preferences.d/pixelated` -# packages will not downgraded to the Pixelated versions if they are lower than -# the LEAP ones. -# see https://github.com/pixelated/project-issues/issues/415 for more details - -# Usage: -# -# Run this script with 'check' as parameter to check if there are -# packages installed from a different repo. In this case, the script will -# exit with an exit code of 1. -# -# Without any parameter it will install all available packages from the -# Pixleated repo. - -set -e -set -o pipefail - -options="$*" - -# For now, default to pixelated as preferred repo -# Could get set via a command line option later -preferred_repo='pixelated' -preferred_repo_url='packages.pixelated-project.org' - -get_installed_packages () { - packages="$(aptitude search "?installed?origin(${preferred_repo})" -F '%p' | tr '\n' ' ' | sed 's/ */ /g' )" - echo "${packages}" -} - -get_installed_packages_from_other_repo () { - packages="$(get_installed_packages)" - - installed=() - for deb in $packages - do - url=$(apt-cache policy "$deb" | awk '/\*\*\*/{getline; print}' | grep -oP 'http.*? ') - if [[ ! "$url" =~ $preferred_repo_url ]] - then - installed+=(${deb}) - fi - done - echo "${installed[@]}" -} - -install_packages_from_preferred_repo () { - packages="$*" - echo "Installing these packages from ${preferred_repo_url}: $packages" - - debs=() - # Use "-y --force-yes" to allow downgrading packages with lower versions - for deb in $packages - do - version=$(apt-cache policy "$deb" | grep -B1 "$preferred_repo_url" | head -1 | sed 's/ //g' | cut -d' ' -f1) - debs+=("${deb}=${version}") - done - cmd="apt-get -y --force-yes install ${debs[*]}" - echo "Using this command to install the packages from ${preferred_repo_url}: ${cmd}" - $cmd -} - -installed_packages_from_other_repo=$(get_installed_packages_from_other_repo) -echo "Found these packages installed from a different repo: ${installed_packages_from_other_repo}" -echo - - -if [ -n "$installed_packages_from_other_repo" ] -then - [[ "$options" == "check" ]] && exit 1 - install_packages_from_preferred_repo "$installed_packages_from_other_repo" -else - echo "Nothing to install - all packages are installed from ${preferred_repo}." -fi diff --git a/files/puppet/modules/pixelated/manifests/agent.pp b/files/puppet/modules/pixelated/manifests/agent.pp index a57a22e..82a2ce0 100644 --- a/files/puppet/modules/pixelated/manifests/agent.pp +++ b/files/puppet/modules/pixelated/manifests/agent.pp @@ -1,7 +1,7 @@ # configure and install the pixelated user agent class pixelated::agent { - include ::pixelated::apt include ::pixelated::apt::preferences + include ::pixelated::install include ::pixelated::unattended_upgrades include ::pixelated::syslog include ::pixelated::check_mk @@ -12,10 +12,6 @@ class pixelated::agent { $services = hiera('services') $default_file = '/etc/default/pixelated-server' - package { 'pixelated-server': - ensure => installed, - } - service { 'pixelated-server': ensure => running, provider => 'systemd', @@ -84,4 +80,3 @@ class pixelated::agent { } } - diff --git a/files/puppet/modules/pixelated/manifests/apt.pp b/files/puppet/modules/pixelated/manifests/apt.pp deleted file mode 100644 index c6280f5..0000000 --- a/files/puppet/modules/pixelated/manifests/apt.pp +++ /dev/null @@ -1,32 +0,0 @@ -# add the pixelated sources and the signing key -class pixelated::apt { - - include apt - - # Use latest packages from i.e. jessie-snapshots (possibly unstable) for - # special domains - - $version = $::domain ? { - /^(staging|dev|unstable)\.pixelated-project\.org$/ => '-snapshots', - /^pixelated-project.local$/ => '-snapshots', - default => '', - } - - apt::sources_list { 'pixelated.list': - content => "deb [arch=amd64] http://packages.pixelated-project.org/debian ${::lsbdistcodename}${version} main\n", - require => Exec[add_pixelated_key], - notify => Exec[refresh_apt], - } - - file { '/srv/leap/0x287A1542472DC0E3_packages@pixelated-project.org.asc': - source => 'puppet:///modules/pixelated/0x287A1542472DC0E3_packages@pixelated-project.org.asc', - notify => Exec['add_pixelated_key'] - } - exec{'add_pixelated_key': - command => '/usr/bin/apt-key add /srv/leap/0x287A1542472DC0E3_packages@pixelated-project.org.asc', - refreshonly => true, - require => File['/srv/leap/0x287A1542472DC0E3_packages@pixelated-project.org.asc'], - } - - include ::pixelated::apt::install_packages_from_pixelated -} diff --git a/files/puppet/modules/pixelated/manifests/apt/install_packages_from_pixelated.pp b/files/puppet/modules/pixelated/manifests/apt/install_packages_from_pixelated.pp deleted file mode 100644 index a9d43af..0000000 --- a/files/puppet/modules/pixelated/manifests/apt/install_packages_from_pixelated.pp +++ /dev/null @@ -1,20 +0,0 @@ -# Prefer all installed packages from the pixelayed repo -class pixelated::apt::install_packages_from_pixelated { - - file { '/usr/local/bin/prefer_package_repo.sh': - source => 'puppet:///modules/pixelated/prefer_package_repo.sh', - owner => 'root', - group => 'root', - mode => '0755', - } - - exec { 'prefer_pixelated_packages': - command => '/usr/local/bin/prefer_package_repo.sh', - unless => '/usr/local/bin/prefer_package_repo.sh check', - require => [ - Package[ 'leap-keymanager', 'leap-mx', 'soledad-client', 'soledad-server' ], - File['/usr/local/bin/prefer_package_repo.sh'] - ] - } - -} diff --git a/files/puppet/modules/pixelated/manifests/apt/preferences.pp b/files/puppet/modules/pixelated/manifests/apt/preferences.pp index 51e16c9..badada3 100644 --- a/files/puppet/modules/pixelated/manifests/apt/preferences.pp +++ b/files/puppet/modules/pixelated/manifests/apt/preferences.pp @@ -1,4 +1,4 @@ -# pin packages so they have precedence over those from the leap repo +# pin packages class pixelated::apt::preferences { apt::preferences_snippet { ['python-urllib3', 'python-requests','python-six']: @@ -6,12 +6,6 @@ class pixelated::apt::preferences { priority => 999 } - apt::preferences_snippet { 'pixelated': - priority => 1000, - package => '*', - pin => 'origin "packages.pixelated-project.org"' - } - file { [ '/etc/apt/preferences.d/soledad-client', '/etc/apt/preferences.d/soledad-server', @@ -21,4 +15,14 @@ class pixelated::apt::preferences { ensure => absent } + + # Remove legacy apt repo resources + file { '/etc/apt/sources.list.d/pixelated.list': + ensure => absent, + notify => Exec[refresh_apt], + } + apt::preferences_snippet { 'pixelated': + ensure => absent, + } + } diff --git a/files/puppet/modules/pixelated/manifests/install.pp b/files/puppet/modules/pixelated/manifests/install.pp new file mode 100644 index 0000000..732e55f --- /dev/null +++ b/files/puppet/modules/pixelated/manifests/install.pp @@ -0,0 +1,48 @@ +# Installs pixelated-server and pixelated-user-agent +class pixelated::install ( + $release = '1.0_beta1', + $pixelated_server_deb = 'pixelated-server_0.2.162.gbpba0081_all.deb', + $pixelated_user_agent_deb = 'pixelated-user-agent_0.6.699.gbpc8f588_all.deb' +) { + + + + exec { 'fetch_pixelated_user_agent': + command => "/usr/bin/wget https://github.com/pixelated/pixelated-user-agent/releases/download/${release}/${pixelated_user_agent_deb}", + cwd => '/var/tmp', + creates => "/var/tmp/${pixelated_user_agent_deb}" + } + + exec { 'fetch_pixelated_server': + command => "/usr/bin/wget https://github.com/pixelated/pixelated-user-agent/releases/download/${release}/${pixelated_server_deb}", + cwd => '/var/tmp', + creates => "/var/tmp/${pixelated_server_deb}" + } + + package { + # Dependencies of pixelated-user-agent + [ 'libffi6', 'libsqlcipher0', 'python' ]: + ensure => installed; + 'pixelated-user-agent': + ensure => latest, + provider => 'dpkg', + source => "/var/tmp/${pixelated_user_agent_deb}", + require => [ + Exec['fetch_pixelated_user_agent'], + Package['libffi6'], + Package['libsqlcipher0'], + Package['libssl-dev'], + Package['python'], + ]; + # Dependencies of pixelated-server + [ 'python-sqlcipher', 'systemd' ]: + ensure => installed; + 'pixelated-server': + ensure => latest, + provider => 'dpkg', + source => "/var/tmp/${pixelated_server_deb}", + require => [ + Exec['fetch_pixelated_server'], + Package['pixelated-user-agent'] ] + } +} diff --git a/files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb b/files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb index 8b071f1..27297db 100644 --- a/files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb +++ b/files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb @@ -15,11 +15,6 @@ describe 'pixelated::apt::preferences' do "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian',$package='*',$ensure='present') {}", ] } - describe 'pixelated packages' do - it { should contain_apt__preferences_snippet("pixelated").with_pin('origin "packages.pixelated-project.org"')} - it { should contain_apt__preferences_snippet("pixelated").with_priority('1000')} - end - %w( soledad-server soledad-client soledad-common leap-keymanager leap-auth).each do | file | it { should contain_file("/etc/apt/preferences.d/#{file}").with_ensure('absent')} end diff --git a/files/puppet/modules/pixelated/spec/classes/apt_spec.rb b/files/puppet/modules/pixelated/spec/classes/apt_spec.rb deleted file mode 100644 index 102f658..0000000 --- a/files/puppet/modules/pixelated/spec/classes/apt_spec.rb +++ /dev/null @@ -1,58 +0,0 @@ -require 'spec_helper' - -describe 'pixelated::apt' do - let(:facts) do - { - :operatingsystem => 'Debian', - :lsbdistid => 'Debian', - :domain => 'default', - :lsbdistcodename => 'jessie', - } - end - - let(:pre_condition) { [ - "class apt {}", - "define apt::sources_list($content='deb url') {}", - ] } - - it { should contain_apt__sources_list('pixelated.list'). - with_content("deb [arch=amd64] http://packages.pixelated-project.org/debian jessie main\n") } - it { should contain_file('/srv/leap/0x287A1542472DC0E3_packages@pixelated-project.org.asc') } - it { should contain_exec('add_pixelated_key') } - - context 'staging' do - let(:facts) do - { - :domain => 'staging.pixelated-project.org', - :lsbdistcodename => 'jessie', - } - end - - it { should contain_apt__sources_list('pixelated.list'). - with_content("deb [arch=amd64] http://packages.pixelated-project.org/debian jessie-snapshots main\n") } - end - - context 'unstable' do - let(:facts) do - { - :domain => 'unstable.pixelated-project.org', - :lsbdistcodename => 'jessie', - } - end - - it { should contain_apt__sources_list('pixelated.list'). - with_content("deb [arch=amd64] http://packages.pixelated-project.org/debian jessie-snapshots main\n") } - end - - context 'vagrant' do - let(:facts) do - { - :domain => 'pixelated-project.local', - :lsbdistcodename => 'jessie', - } - end - - it { should contain_apt__sources_list('pixelated.list'). - with_content("deb [arch=amd64] http://packages.pixelated-project.org/debian jessie-snapshots main\n") } - end -end |