summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2017-02-09 10:05:07 +0100
committervarac <varacanero@zeromail.org>2017-02-09 10:05:07 +0100
commitf3eafa18540e84eb1673df6ff316ce453eb86429 (patch)
tree887dfda48190a1e5aa2e5e4af8d56535cfca7b3c
parent410cee61b6cf5b792b4c74493c0f699260c22743 (diff)
git subrepo clone --force https://github.com/pixelated/puppet-pixelated.git files/puppet/modules/pixelated
subrepo: subdir: "files/puppet/modules/pixelated" merged: "0b29fe6" upstream: origin: "https://github.com/pixelated/puppet-pixelated.git" branch: "master" commit: "0b29fe6" git-subrepo: version: "0.3.0" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "841aa43"
-rw-r--r--files/puppet/modules/pixelated/.fixtures-leap-pinned.yml2
-rw-r--r--files/puppet/modules/pixelated/.gitignore6
-rw-r--r--files/puppet/modules/pixelated/.gitrepo4
-rw-r--r--files/puppet/modules/pixelated/Gemfile1
-rw-r--r--files/puppet/modules/pixelated/Gemfile.lock4
-rw-r--r--files/puppet/modules/pixelated/files/check_mk/user-agent.cfg28
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/checkboxes_and_mailboxes.feature2
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/compose_save_draft_and_send.feature2
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/environment.py23
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_page.py2
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/search_and_destroy.feature2
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/send_mail.feature11
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/__init__.py12
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/account.py2
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/common.py18
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/mail_list.py8
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/steps/send_mail.py75
-rw-r--r--files/puppet/modules/pixelated/files/functional-tests/tag_and_reply.feature3
-rw-r--r--files/puppet/modules/pixelated/manifests/agent.pp7
-rw-r--r--files/puppet/modules/pixelated/manifests/apt.pp7
-rw-r--r--files/puppet/modules/pixelated/manifests/apt/preferences.pp20
-rw-r--r--files/puppet/modules/pixelated/manifests/check_mk.pp10
-rw-r--r--files/puppet/modules/pixelated/spec/classes/agent_spec.rb2
-rw-r--r--files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb19
-rw-r--r--files/puppet/modules/pixelated/spec/classes/apt_spec.rb27
-rw-r--r--files/puppet/modules/pixelated/spec/classes/pixelated_spec.rb2
-rw-r--r--files/puppet/modules/pixelated/spec/classes/syslog_spec.rb2
27 files changed, 173 insertions, 128 deletions
diff --git a/files/puppet/modules/pixelated/.fixtures-leap-pinned.yml b/files/puppet/modules/pixelated/.fixtures-leap-pinned.yml
index fff8ea7..acad52f 100644
--- a/files/puppet/modules/pixelated/.fixtures-leap-pinned.yml
+++ b/files/puppet/modules/pixelated/.fixtures-leap-pinned.yml
@@ -9,6 +9,6 @@ fixtures:
templatewlv: "#{source_dir}/spec/fixtures/modules/leap_platform/puppet/modules/templatewlv"
repositories:
leap_platform:
- repo: "https://github.com/pixelated/leap_platform.git"
+ repo: "https://0xacab.org/pixelated/platform.git"
flags: "--recursive"
diff --git a/files/puppet/modules/pixelated/.gitignore b/files/puppet/modules/pixelated/.gitignore
index 3937395..5b60ad3 100644
--- a/files/puppet/modules/pixelated/.gitignore
+++ b/files/puppet/modules/pixelated/.gitignore
@@ -6,3 +6,9 @@
# ignore files created by functional test
/files/functional-tests/ghostdriver.log
*.pyc
+# ignore bundles
+.bundle/
+vendor/
+# ignore rbenv files
+.ruby-version
+.rbenv-gemsets
diff --git a/files/puppet/modules/pixelated/.gitrepo b/files/puppet/modules/pixelated/.gitrepo
index fccc325..2f63757 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 = 21f03408aea72a5dfd50d19944fbe1f8e9b209e9
- parent = 16aafa5ba4b629ea65d53454fa5c9af1ca7c8250
+ commit = 0b29fe628ee009489a74d185c500a7ec5c5aaa6b
+ parent = 410cee61b6cf5b792b4c74493c0f699260c22743
cmdver = 0.3.0
diff --git a/files/puppet/modules/pixelated/Gemfile b/files/puppet/modules/pixelated/Gemfile
index ab3bf5e..6c1defa 100644
--- a/files/puppet/modules/pixelated/Gemfile
+++ b/files/puppet/modules/pixelated/Gemfile
@@ -1,6 +1,7 @@
source "https://rubygems.org"
group :test do
+ gem "safe_yaml"
gem "rake",'< 11'
gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.8.0'
gem "rspec", '< 3.2.0'
diff --git a/files/puppet/modules/pixelated/Gemfile.lock b/files/puppet/modules/pixelated/Gemfile.lock
index 98aa139..44ff38d 100644
--- a/files/puppet/modules/pixelated/Gemfile.lock
+++ b/files/puppet/modules/pixelated/Gemfile.lock
@@ -58,6 +58,7 @@ GEM
puppet
rspec-puppet-utils (2.2.1)
rspec-support (3.1.2)
+ safe_yaml (1.0.4)
spdx-licenses (1.1.0)
stomp (1.4.3)
systemu (2.6.5)
@@ -74,6 +75,7 @@ DEPENDENCIES
rspec-puppet
rspec-puppet-facts
rspec-puppet-utils
+ safe_yaml
BUNDLED WITH
- 1.11.2
+ 1.13.7
diff --git a/files/puppet/modules/pixelated/files/check_mk/user-agent.cfg b/files/puppet/modules/pixelated/files/check_mk/user-agent.cfg
new file mode 100644
index 0000000..1523125
--- /dev/null
+++ b/files/puppet/modules/pixelated/files/check_mk/user-agent.cfg
@@ -0,0 +1,28 @@
+/var/log/pixelated/user-agent.log
+# ignore requests that are fine
+# ignore login with wrong credentials
+ I Unauthorized login for
+ I throwExceptionIntoGenerator
+# issue 904
+ I <class 'leap.soledad.common.l2db.errors.DatabaseDoesNotExist'>
+# issue 905
+ I ERROR got exception when syncing
+ I leap.soledad.common.errors.InvalidAuthTokenError
+# issue 913
+ I exception caught here
+ I exceptions.IOError:.*No such file or directory
+#
+ I twisted.internet.error.ConnectionRefusedError: Connection was refused by other side: 111: Connection refused
+ I twisted.mail.smtp.SMTPDeliveryError
+ I exceptions.AssertionError: Found more than one key for address
+ I column doc_id is not unique
+ I u1db.errors.RevisionConflict
+ I An error has ocurred adding attached key
+ W warning
+ C error
+ C failure
+ C requests.exceptions.SSLError
+ C u1db.errors
+ C exception
+ C BEGIN PGP PRIVATE KEY BLOCK
+ C exceptions.UnicodeEncodeError
diff --git a/files/puppet/modules/pixelated/files/functional-tests/checkboxes_and_mailboxes.feature b/files/puppet/modules/pixelated/files/functional-tests/checkboxes_and_mailboxes.feature
index 430887c..5342f96 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/checkboxes_and_mailboxes.feature
+++ b/files/puppet/modules/pixelated/files/functional-tests/checkboxes_and_mailboxes.feature
@@ -22,7 +22,7 @@ Feature: Checkboxes
So I can manage more than one email at once
Scenario: User has a list of emails in each mailboxes that needs to be managed
- Given I login as behave-testuser
+ Given I'm logged in
When I mark the first unread email as read
And I delete the email
When I select the tag 'trash'
diff --git a/files/puppet/modules/pixelated/files/functional-tests/compose_save_draft_and_send.feature b/files/puppet/modules/pixelated/files/functional-tests/compose_save_draft_and_send.feature
index 95bcc4c..35b282f 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/compose_save_draft_and_send.feature
+++ b/files/puppet/modules/pixelated/files/functional-tests/compose_save_draft_and_send.feature
@@ -21,7 +21,7 @@ Feature: compose mail, save draft and send mail
So I can review and send them later
Scenario: user composes and email, save the draft, later sends the draft and checks the sent message
- Given I login as behave-testuser
+ Given I'm logged in
When I compose a message to 'pixelated@friends.org'
When I select the tag 'drafts'
When I open the first mail in the mail list
diff --git a/files/puppet/modules/pixelated/files/functional-tests/environment.py b/files/puppet/modules/pixelated/files/functional-tests/environment.py
index 91d911b..907450d 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/environment.py
+++ b/files/puppet/modules/pixelated/files/functional-tests/environment.py
@@ -14,16 +14,14 @@
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.
import os
-from page_objects import SignUpPage, LeapLoginPage
+from page_objects import SignUpPage
from selenium import webdriver
-from selenium.webdriver.common.by import By
-from steps.common import get_invite_code, RandomUser
-from steps import behave_testuser, behave_password, delete_soledad_server_db, delete_soledad_client_db, signup_url
+from steps.common import RandomUser
import subprocess
+
def before_all(context):
set_browser(context)
- create_behave_user(context)
context.random_user = RandomUser
@@ -43,7 +41,6 @@ def after_scenario(context, scenario):
def after_all(context):
- _delete_user(context, behave_testuser())
_delete_user(context, context.random_user.username)
if hasattr(context, 'browser'):
context.browser.quit()
@@ -88,17 +85,3 @@ def set_browser(context):
context.browser.set_window_size(1280, 1024)
context.browser.implicitly_wait(10)
context.browser.set_page_load_timeout(60)
-
-
-def create_behave_user(context):
- username = behave_testuser()
- password = behave_password()
- context.browser.get(signup_url())
- signup_page = SignUpPage(context)
- signup_page.wait_until_element_is_visible_by_locator((By.CSS_SELECTOR, 'input#srp_username'))
- signup_page.enter_username(username)
- signup_page.enter_password(password)
- signup_page.enter_password_confirmation(password)
- signup_page.enter_invite_code(get_invite_code())
- signup_page.click_signup_button()
- # context.browser.quit()
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_page.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_page.py
index d92290b..786f9f7 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_page.py
+++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/mail_page.py
@@ -23,7 +23,7 @@ class MailPage(BasePageObject):
self._locators = {
'encrypted_flag': '.security-status__label--encrypted',
'unencrypted_flag': '.security-status__label--not-encrypted',
- 'undercryptable_flag': '.security-status__label--encryption-error',
+ 'undecryptable_flag': '.security-status__label--encryption-error',
'subject': '#mail-view .subject',
'body': '#mail-view .bodyArea',
'tags': '#mail-view .tagsArea .tag',
diff --git a/files/puppet/modules/pixelated/files/functional-tests/search_and_destroy.feature b/files/puppet/modules/pixelated/files/functional-tests/search_and_destroy.feature
index 2ed3ecd..519ec8b 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/search_and_destroy.feature
+++ b/files/puppet/modules/pixelated/files/functional-tests/search_and_destroy.feature
@@ -23,7 +23,7 @@ Feature: search mail and deletion
So I can manage them
Scenario: User searches for a mail and deletes it
- Given I login as behave-testuser
+ Given I'm logged in
When I search for a mail with the words "mail"
When I open the first mail in the mail list
Then I see one or more mails in the search results
diff --git a/files/puppet/modules/pixelated/files/functional-tests/send_mail.feature b/files/puppet/modules/pixelated/files/functional-tests/send_mail.feature
index e020fd3..1e0495f 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/send_mail.feature
+++ b/files/puppet/modules/pixelated/files/functional-tests/send_mail.feature
@@ -19,16 +19,15 @@ Feature: send_mail
@mail_to_myself
Scenario: user logs in end sends a mail to self
- Given I login as behave-testuser
+ Given I'm logged in
When I send a mail to myself
-# And I see that the mail was sent
When I open the email
Then I see a encrypted flag
@unencrypted
Scenario: user receives an unencrypted email
Given I send an unencrypted email
- And I login as behave-testuser
+ When I login
When I open the unencrypted email
Then I see a unencrypted email flag
@@ -36,13 +35,13 @@ Feature: send_mail
@undecryptable
Scenario: user receives an email we cannot decrypt
Given I send an email encrypted to someone else
- And I login as behave-testuser
+ When I login
When I open the undecryptable email
Then I see a undecryptable flag
@logout
- Scenario: behave-testuser logs out
- Given I login as behave-testuser
+ Scenario: user logs out
+ Given I'm logged in
When I logout
And I visit the user-agent
Then I should see a login button
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/__init__.py b/files/puppet/modules/pixelated/files/functional-tests/steps/__init__.py
index dbc9cc6..c68856b 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/steps/__init__.py
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/__init__.py
@@ -51,18 +51,6 @@ def leap_login_url():
return url_home() + '/login'
-def behave_email():
- return '%s@%s' % (behave_testuser(), hostname)
-
-
-def behave_password():
- return 'Eido6aeg3za9ooNiekiemahm'
-
-
-def behave_testuser():
- return 'behave-testuser'
-
-
def _netrc_couch_credentials():
with open('/etc/couchdb/couchdb.netrc', 'r') as netrc:
netrc_line = netrc.readline().strip().split(' ')
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/account.py b/files/puppet/modules/pixelated/files/functional-tests/steps/account.py
index 51a6837..bdbf2e2 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/steps/account.py
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/account.py
@@ -36,8 +36,10 @@ def step_impl(context):
context.browser.find_element_by_name('login')
+@given(u'I\'m logged in')
@when(u'I login')
def step_impl(context):
+ context.browser.get(login_url())
login_page = LoginPage(context)
login_page.enter_username(context.random_user.username).enter_password(context.random_user.password).login()
login_page.wait_interstitial_page()
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/common.py b/files/puppet/modules/pixelated/files/functional-tests/steps/common.py
index 7a54236..29d34df 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/steps/common.py
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/common.py
@@ -20,7 +20,7 @@ from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from email.mime.text import MIMEText
-from steps import behave_email, hostname
+from steps import hostname
import string
import random
@@ -33,6 +33,7 @@ MAX_WAIT_IN_S = 120
class RandomUser(object):
username = 'test_user_' + ''.join(random.choice(string.lowercase) for i in range(16))
password = ''.join(random.choice(string.lowercase) for i in range(16))
+ email = '%s@%s' % (username, hostname)
def get_invite_code():
@@ -61,14 +62,14 @@ def save_source(context, filename='/tmp/source.html'):
out.write(context.browser.page_source.encode('utf8'))
-def send_external_email(subject, body):
+def send_external_email(context, subject, body):
msg = MIMEText(body)
msg['Subject'] = subject
- msg['From'] = behave_email()
- msg['To'] = behave_email()
+ msg['From'] = context.random_user.email
+ msg['To'] = context.random_user.email
s = smtplib.SMTP(hostname)
- s.sendmail(behave_email(), [behave_email()], msg.as_string())
+ s.sendmail(context.random_user.email, [context.random_user.email], msg.as_string())
s.quit()
@@ -76,10 +77,3 @@ def open_email(context, subject):
locator = '//ul[@id="mail-list"]//*[contains(.,"%s")]/parent::a' % subject
wait_long_until_element_is_visible_by_locator(context, (By.XPATH, locator)).click()
-
-
-
-
-
-
-
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/mail_list.py b/files/puppet/modules/pixelated/files/functional-tests/steps/mail_list.py
index d5cb324..2f7cf40 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/steps/mail_list.py
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/mail_list.py
@@ -20,7 +20,9 @@ from ..page_objects import PixelatedPage
from ..page_objects import MailList
from ..page_objects import MailListActions
-
+#FROM USER AGENT REPO
+from selenium.common.exceptions import NoSuchElementException
+from time import sleep
@then('I see the email on the mail list')
@@ -29,10 +31,6 @@ def impl(context):
pixelated_page.is_mail_on_list(context.pixelated_email, pixelated_page.random_subject(), 240)
-#FROM USER AGENT REPO
-from selenium.common.exceptions import NoSuchElementException
-from time import sleep
-
def find_current_mail(context):
return context.browser.find_element_by_id(context.current_mail_id)
diff --git a/files/puppet/modules/pixelated/files/functional-tests/steps/send_mail.py b/files/puppet/modules/pixelated/files/functional-tests/steps/send_mail.py
index 99d6d95..b7e5a93 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/steps/send_mail.py
+++ b/files/puppet/modules/pixelated/files/functional-tests/steps/send_mail.py
@@ -23,30 +23,11 @@ from ..page_objects import Notification
from behave import *
from common import *
-from steps import behave_email, behave_password, behave_testuser, login_url
-
-
-@given(u'I login as behave-testuser')
-def step_impl(context):
- context.browser.get(login_url())
- login_page = LoginPage(context)
- login_page.enter_username(behave_testuser()).enter_password(behave_password()).login()
- login_page.wait_interstitial_page()
-
-
-@given(u'I send an unencrypted email')
-def step_impl(context):
- send_external_email('unencrypted email %s' %random_subject(), 'some body')
-
-
-@given(u'I send an email encrypted to someone else')
-def step_impl(context):
- send_external_email('undecryptable email %s' %random_subject(), encrypted_body())
@when(u'I send a mail to myself')
def step_impl(context):
- email_to = behave_email()
+ email_to = context.random_user.email
compose_box = ComposeBox(context)
maillist_actions = MailListActions(context)
@@ -57,55 +38,65 @@ def step_impl(context):
compose_box.send_mail()
+@when(u'I open the email')
+def step_impl(context):
+ subject = 'email to myself %s' % random_subject()
+ email_from = context.random_user.username
+
+ maillist = MailList(context)
+ maillist.select_mail(email_from, subject)
+
+
+@then(u'I see a encrypted flag')
+def step_impl(context):
+ mail_page = MailPage(context)
+ mail_page.check_mail_flag('encrypted_flag')
+
+
@when(u'I see that the mail was sent')
def step_impl(context):
notification = Notification(context)
notification.wait_for_notification("message_sent")
-@when(u'I open the email')
+@given(u'I send an email encrypted to someone else')
def step_impl(context):
- subject = 'email to myself %s' % random_subject()
- behave_user = behave_testuser()
-
- maillist = MailList(context)
- maillist.select_mail(behave_user, subject)
+ send_external_email(context, 'undecryptable email %s' %random_subject(), encrypted_body())
@when(u'I open the undecryptable email')
def step_impl(context):
subject = 'undecryptable email %s' % random_subject()
- behave_user = behave_testuser()
+ email_from = context.random_user.username
maillist = MailList(context)
- maillist.select_mail(behave_user, subject)
+ maillist.select_mail(email_from, subject)
-@when(u'I open the unencrypted email')
+@then(u'I see a undecryptable flag')
def step_impl(context):
- subject = 'unencrypted email %s' % random_subject()
- behave_user = behave_testuser()
-
- maillist = MailList(context)
- maillist.select_mail(behave_user, subject)
+ mail_page = MailPage(context)
+ mail_page.check_mail_flag('undecryptable_flag')
-@then(u'I see a encrypted flag')
+@given(u'I send an unencrypted email')
def step_impl(context):
- mail_page = MailPage(context)
- mail_page.check_mail_flag('encrypted_flag')
+ send_external_email(context, 'unencrypted email %s' %random_subject(), 'some body')
-@then(u'I see a unencrypted email flag')
+@when(u'I open the unencrypted email')
def step_impl(context):
- mail_page = MailPage(context)
- mail_page.check_mail_flag('unencrypted_flag')
+ subject = 'unencrypted email %s' % random_subject()
+ email_from = context.random_user.username
+ maillist = MailList(context)
+ maillist.select_mail(email_from, subject)
-@then(u'I see a undecryptable flag')
+
+@then(u'I see a unencrypted email flag')
def step_impl(context):
mail_page = MailPage(context)
- mail_page.check_mail_flag('undercryptable_flag')
+ mail_page.check_mail_flag('unencrypted_flag')
def encrypted_body():
diff --git a/files/puppet/modules/pixelated/files/functional-tests/tag_and_reply.feature b/files/puppet/modules/pixelated/files/functional-tests/tag_and_reply.feature
index 0cbc7e1..178ad20 100644
--- a/files/puppet/modules/pixelated/files/functional-tests/tag_and_reply.feature
+++ b/files/puppet/modules/pixelated/files/functional-tests/tag_and_reply.feature
@@ -21,8 +21,7 @@ Feature: Tag and reply
So that I can easily find them
Scenario: User tags a mail, replies to it then checks that mail is in the right tag
-# Given I have a mail in my inbox
- Given I login as behave-testuser
+ Given I'm logged in
When I open the first mail in the 'inbox'
When I add the tag 'website' to that mail
Then I see that mail under the 'website' tag
diff --git a/files/puppet/modules/pixelated/manifests/agent.pp b/files/puppet/modules/pixelated/manifests/agent.pp
index cdcdfd9..a57a22e 100644
--- a/files/puppet/modules/pixelated/manifests/agent.pp
+++ b/files/puppet/modules/pixelated/manifests/agent.pp
@@ -4,6 +4,7 @@ class pixelated::agent {
include ::pixelated::apt::preferences
include ::pixelated::unattended_upgrades
include ::pixelated::syslog
+ include ::pixelated::check_mk
include ::pixelated::tests
$domain_hash = hiera('domain')
@@ -16,8 +17,10 @@ class pixelated::agent {
}
service { 'pixelated-server':
- ensure => running,
- require => [
+ ensure => running,
+ provider => 'systemd',
+ enable => true,
+ require => [
Package['pixelated-server'],
Service['apache']
]
diff --git a/files/puppet/modules/pixelated/manifests/apt.pp b/files/puppet/modules/pixelated/manifests/apt.pp
index b96afbf..76f4697 100644
--- a/files/puppet/modules/pixelated/manifests/apt.pp
+++ b/files/puppet/modules/pixelated/manifests/apt.pp
@@ -3,8 +3,13 @@ class pixelated::apt {
include apt
+ $version = $::domain ? {
+ /^(staging|dev|unstable)\.pixelated-project\.org$/ => '-snapshots',
+ default => '',
+ }
+
apt::sources_list { 'pixelated.list':
- content => "deb [arch=amd64] http://packages.pixelated-project.org/debian ${::lsbdistcodename} main\n",
+ content => "deb [arch=amd64] http://packages.pixelated-project.org/debian ${::lsbdistcodename}${version} main\n",
require => Exec[add_pixelated_key],
notify => Exec[refresh_apt],
}
diff --git a/files/puppet/modules/pixelated/manifests/apt/preferences.pp b/files/puppet/modules/pixelated/manifests/apt/preferences.pp
index 719117b..51e16c9 100644
--- a/files/puppet/modules/pixelated/manifests/apt/preferences.pp
+++ b/files/puppet/modules/pixelated/manifests/apt/preferences.pp
@@ -6,13 +6,19 @@ class pixelated::apt::preferences {
priority => 999
}
- apt::preferences_snippet { ['soledad-server',
- 'soledad-common',
- 'soledad-client',
- 'leap-keymanager',
- 'leap-auth']:
- pin => 'release o=pixelated',
- 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',
+ '/etc/apt/preferences.d/soledad-common',
+ '/etc/apt/preferences.d/leap-keymanager',
+ '/etc/apt/preferences.d/leap-auth']:
+ ensure => absent
}
}
diff --git a/files/puppet/modules/pixelated/manifests/check_mk.pp b/files/puppet/modules/pixelated/manifests/check_mk.pp
new file mode 100644
index 0000000..52ab490
--- /dev/null
+++ b/files/puppet/modules/pixelated/manifests/check_mk.pp
@@ -0,0 +1,10 @@
+# tune check_mk_agent for pixelated specific stuff
+# see https://github.com/pixelated-project/pixelated-platform/issues/20
+class pixelated::check_mk {
+
+ file { '/etc/check_mk/logwatch.d/user-agent.cfg':
+ source => 'puppet:///modules/pixelated/check_mk/user-agent.cfg',
+ require => Package['check-mk-agent-logwatch'];
+ }
+
+}
diff --git a/files/puppet/modules/pixelated/spec/classes/agent_spec.rb b/files/puppet/modules/pixelated/spec/classes/agent_spec.rb
index f55be37..2ba956b 100644
--- a/files/puppet/modules/pixelated/spec/classes/agent_spec.rb
+++ b/files/puppet/modules/pixelated/spec/classes/agent_spec.rb
@@ -25,7 +25,7 @@ require 'spec_helper'
"define apache::vhost::file($content,$mod_security) {}",
"define apt::sources_list($content='deb url') {}",
"define apt::apt_conf($source='file url',$refresh_apt='true') {}",
- "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian') {}",
+ "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian',$package='*',$ensure='present') {}",
] }
it { should contain_class('pixelated::syslog') }
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 778e739..8b071f1 100644
--- a/files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb
+++ b/files/puppet/modules/pixelated/spec/classes/apt_preferences_spec.rb
@@ -12,15 +12,20 @@ describe 'pixelated::apt::preferences' do
let(:pre_condition) { [
"class apt {}",
"define apt::sources_list($content='deb url') {}",
- "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian') {}",
+ "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian',$package='*',$ensure='present') {}",
] }
-# %w( soledad-server soledad-client soledad-common leap-keymanager leap-auth).each do | package |
- #it { should contain_apt__preferences_snippet("#{package}").with_pin('release o=pixelated')}
- #end
+ 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
- # %w( python-urllib3 python-requests python-six).each do | package |
- #it { should contain_apt__preferences_snippet("#{package}").with_release(/jessie/) }
- #end
+ %w( python-urllib3 python-requests python-six).each do | package |
+ it { should contain_apt__preferences_snippet("#{package}").with_release(/jessie/) }
+ end
end
diff --git a/files/puppet/modules/pixelated/spec/classes/apt_spec.rb b/files/puppet/modules/pixelated/spec/classes/apt_spec.rb
index df5c33f..7fe995a 100644
--- a/files/puppet/modules/pixelated/spec/classes/apt_spec.rb
+++ b/files/puppet/modules/pixelated/spec/classes/apt_spec.rb
@@ -5,6 +5,7 @@ describe 'pixelated::apt' do
{
:operatingsystem => 'Debian',
:lsbdistid => 'Debian',
+ :domain => 'default',
:lsbdistcodename => 'jessie',
}
end
@@ -14,8 +15,32 @@ describe 'pixelated::apt' do
"define apt::sources_list($content='deb url') {}",
] }
- it { should contain_apt__sources_list('pixelated.list') }
+ 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
end
diff --git a/files/puppet/modules/pixelated/spec/classes/pixelated_spec.rb b/files/puppet/modules/pixelated/spec/classes/pixelated_spec.rb
index b24f721..4d9386e 100644
--- a/files/puppet/modules/pixelated/spec/classes/pixelated_spec.rb
+++ b/files/puppet/modules/pixelated/spec/classes/pixelated_spec.rb
@@ -21,7 +21,7 @@ describe 'pixelated' do
"define apache::vhost::file($content,$mod_security) {}",
"define apt::sources_list($content='deb url') {}",
"define apt::apt_conf($source='file url',$refresh_apt='true') {}",
- "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian') {}",
+ "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian',$package='*',$ensure='present') {}",
] }
it { should contain_class('pixelated::agent') }
diff --git a/files/puppet/modules/pixelated/spec/classes/syslog_spec.rb b/files/puppet/modules/pixelated/spec/classes/syslog_spec.rb
index f1b98a4..b4aacbf 100644
--- a/files/puppet/modules/pixelated/spec/classes/syslog_spec.rb
+++ b/files/puppet/modules/pixelated/spec/classes/syslog_spec.rb
@@ -15,7 +15,7 @@ describe 'pixelated::syslog' do
"define apache::vhost::file($content,$mod_security) {}",
"define apt::sources_list($content='deb url') {}",
"define apt::apt_conf($source='file url') {}",
- "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian') {}",
+ "define apt::preferences_snippet($release='stable',$priority='999',$pin='release o=Debian',$package='*',$ensure='present') {}",
] }