File tree 14 files changed +199
-55
lines changed
14 files changed +199
-55
lines changed Original file line number Diff line number Diff line change
1
+ fixtures :
2
+ repositories :
3
+ " apt " : " https://github.com/puppetlabs/puppetlabs-apt"
4
+ " stdlib " :
5
+ " repo " : " git://github.com/puppetlabs/puppetlabs-stdlib.git"
6
+ " ref " : " v2.2.1"
7
+ symlinks :
8
+ " opsmatic " : " #{source_dir}"
Original file line number Diff line number Diff line change
1
+ language : ruby
2
+ bundler_args : --without development
3
+ script :
4
+ - " bundle exec rake lint"
5
+ - " bundle exec rake spec SPEC_OPTS='--format documentation --color'"
6
+ rvm :
7
+ - 1.8.7
8
+ - 1.9.3
9
+ - 2.0.0
10
+ env :
11
+ - PUPPET_GEM_VERSION="~> 3.4.0"
12
+ - PUPPET_GEM_VERSION="~> 3.5.0"
Original file line number Diff line number Diff line change
1
+ source "https://rubygems.org"
2
+
3
+ # Required for unit testing
4
+ gem 'facter' , :require => false , :group => :test
5
+ gem 'puppet' , :require => false , :group => :test
6
+ gem 'puppet-lint' , :require => false , :group => :test
7
+ gem 'puppetlabs_spec_helper' , :require => false , :group => :test
8
+ gem 'rake' , :require => false , :group => :test
9
+ gem "rspec-puppet" , :require => false , :group => :test
10
+ gem 'rspec-hiera-puppet' , :require => false , :group => :test
11
+ gem 'rspec-mocks' , :require => false , :group => :test
Original file line number Diff line number Diff line change 16
16
To use this module you will need to set the variable ` $token ` in
17
17
your puppet configuration:
18
18
19
- class { "opsmatic::puppet-reporter ":
19
+ class { "opsmatic::puppet_reporter ":
20
20
token => "my_integration_token",
21
21
}
22
22
Original file line number Diff line number Diff line change
1
+ require 'rubygems'
2
+ require 'puppetlabs_spec_helper/rake_tasks'
3
+ require 'puppet-lint/tasks/puppet-lint'
4
+
5
+ # Puppet-lint Rake Specific settings
6
+ PuppetLint . configuration . send ( 'disable_80chars' )
7
+ PuppetLint . configuration . send ( 'disable_class_inherits_from_params_class' )
8
+ PuppetLint . configuration . with_context = true
9
+ PuppetLint . configuration . fail_on_warnings = true
Original file line number Diff line number Diff line change
1
+ # == Class opsmatic::debian
2
+ #
3
+ # Installs the Opsmatic Puppet Report processor on a Debian host.
4
+ #
5
+ # === Authors
6
+ #
7
+ # <TODO>
8
+ #
1
9
class opsmatic::debian {
2
-
3
- file { "opsmatic_public_debian_repo" :
4
- path => " /etc/apt/sources.list.d/opsmatic_public.list" ,
5
- ensure => file ,
6
- content => template (" opsmatic/opsmatic_public.list.erb" ),
7
- notify => Exec[" opsmatic_public_update_repo_cache" ],
8
- before => Exec[" opsmatic_public_debian_key" ]
9
- }
10
-
11
- exec { "opsmatic_public_debian_key" :
12
- command => " /usr/bin/wget -qO - https://packagecloud.io/gpg.key | apt-key add -" ,
13
- require => File [" opsmatic_public_debian_repo" ],
14
- notify => Exec[" opsmatic_public_update_repo_cache" ]
10
+ apt::key { 'D59097AB' :
11
+ key_source => ' https://packagecloud.io/gpg.key' ,
15
12
}
16
13
17
- exec { "opsmatic_public_update_repo_cache" :
18
- command => " /usr/bin/apt-get update" ,
19
- require => Exec[" opsmatic_public_debian_key" ]
14
+ apt::source { 'opsmatic_public_debian_repo' :
15
+ location => ' https://packagecloud.io/opsmatic/public/any/' ,
16
+ include_src => false ,
17
+ release => ' any' ,
18
+ repos => ' main' ;
20
19
}
21
-
22
20
}
Original file line number Diff line number Diff line change
1
+ # == Class: opsmatic::init
2
+ #
3
+ # === Authors
4
+ #
5
+ # <TODO>
6
+ #
1
7
class opsmatic::init {
2
8
}
Original file line number Diff line number Diff line change
1
+ # == Class: opsmatic::params
2
+ #
3
+ # Common class parameters for the Opsmatic puppet class
4
+ #
5
+ # === Authors
6
+ #
7
+ # <TODO>
8
+ #
1
9
class opsmatic::params {
2
10
3
11
# Integration token
4
- $token = " "
12
+ $token = ' '
5
13
6
14
# Opsmatic webhooks events endpoint
7
- $opsmatic_event_http = " https://api.opsmatic.com/webhooks/events"
15
+ $opsmatic_event_http = ' https://api.opsmatic.com/webhooks/events'
8
16
9
17
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ # == Class: opsmatic-puppet_reporter
2
+ #
3
+ # === Authors
4
+ #
5
+ # <TODO>
6
+ #
7
+ class opsmatic::puppet_reporter (
8
+ $token = $opsmatic::params::token,
9
+ ) inherits opsmatic::params {
10
+
11
+ if $token == ' ' {
12
+ fail(" Your Opsmatic install token is not defined in ${token} " )
13
+ }
14
+
15
+ case $::operatingsystem {
16
+ ' Debian' , ' Ubuntu' : { include opsmatic::debian }
17
+ default: { fail(' Opsmatic Puppet Reporter only supported on Debian and Ubuntu' ) }
18
+ }
19
+
20
+ package { 'opsmatic-puppet-reporter' :
21
+ ensure => present ,
22
+ require => File [' opsmatic_public_debian_repo' ]
23
+ }
24
+
25
+ service { 'opsmatic-puppet-reporter' :
26
+ ensure => running ,
27
+ enable => true ;
28
+ provider => upstart,
29
+ require => Package[' opsmatic-puppet-reporter' ],
30
+ }
31
+
32
+ file { '/etc/init/opsmatic-puppet-reporter.conf' :
33
+ ensure => file ,
34
+ owner => ' root' ,
35
+ group => ' root' ,
36
+ mode => ' 0644' ,
37
+ content => template (' opsmatic/puppet_reporter_upstart.erb' ),
38
+ notify => Service[' opsmatic-puppet-reporter' ],
39
+ }
40
+
41
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " opsmatic" ,
3
+ "version" : " 0.1.2" ,
4
+ "source" : " https://github.com/opsmatic/puppet-opsmatic" ,
5
+ "author" : " Opsmatic" ,
6
+ "license" : " Apache-2.0" ,
7
+ "project_page" : " https://github.com/opsmatic/puppet-opsmatic" ,
8
+ "summary" : " A Puppet module for installing Opsmatic reporter on Puppet runs" ,
9
+ "operatingsystem_support" : [
10
+ {
11
+ "operatingsystem" : " Debian" ,
12
+ "operatingsystemrelease" : [
13
+ " 6" ,
14
+ " 7"
15
+ ]
16
+ },
17
+ {
18
+ "operatingsystem" : " Ubuntu" ,
19
+ "operatingsystemrelease" : [
20
+ " 10.04" ,
21
+ " 12.04"
22
+ ]
23
+ }
24
+ ],
25
+ "requirements" : [
26
+ { "name" : " puppet" , "version_requirement" : " 3.x" }
27
+ ],
28
+ "dependencies" : [
29
+ { "name" : " puppetlabs/apt" , "version_requirement" : " >= 1.0.0" }
30
+ ]
31
+ }
Original file line number Diff line number Diff line change
1
+ __default_facts : &default_facts
2
+ unittest : true
3
+ local_run : true
4
+ architecture : x86_64
5
+ ipaddress : 127.0.0.1
6
+ osfamily : Debian
7
+ operatingsystem : Ubuntu
8
+ operatingsystemrelease : 12
9
+ lsbdistid : Ubuntu
10
+ lsbdistcodename : precise
11
+ lsbdistrelease : 12.04
12
+ lsbmajdistrelease : 12
13
+ disable_asserts : true
14
+ interfaces : eth0
15
+ memorysize : 16.00 GB
16
+ processorcount : 1
17
+ processor0 : UnitTest Processor 0
18
+ hardwaremodel : x86_64
19
+ hostname : unittest
20
+ domain : localdomain
21
+ puppetversion : 3.2.3
22
+ rubyversion : 1.8.7
23
+ facterversion : 1.7.4
24
+ kernel : linux
25
+ kernelrelease : 3.2.0-23-generic
26
+ concat_basedir : /var/lib/puppet/concat
27
+ fqdn : unittest.cloud.nextdoor.com
Original file line number Diff line number Diff line change
1
+ require 'spec_helper'
2
+
3
+ # Facts mocked up for unit testing
4
+ FACTS = {
5
+ :osfamily => 'Debian' ,
6
+ :operatingsystem => 'Ubuntu' ,
7
+ :operatingsystemrelease => '12' ,
8
+ :lsbdistid => 'Ubuntu' ,
9
+ :lsbdistcodename => 'precise' ,
10
+ :lsbdistrelease => '12.04' ,
11
+ :lsbmajdistrelease => '12' ,
12
+ :kernel => 'linux' ,
13
+ }
14
+
15
+ describe 'opsmatic::debian' , :type => 'class' do
16
+ context 'default params' do
17
+ let ( :facts ) { FACTS }
18
+ it do
19
+ should compile . with_all_deps
20
+ should contain_apt__key ( 'D59097AB' ) . with (
21
+ 'key_source' => 'https://packagecloud.io/gpg.key' )
22
+ should contain_apt__source ( 'opsmatic_public_debian_repo' ) . with (
23
+ 'location' => 'https://packagecloud.io/opsmatic/public/any/' )
24
+ end
25
+ end
26
+ end
Original file line number Diff line number Diff line change
1
+ require 'rubygems'
2
+ require 'puppetlabs_spec_helper/module_spec_helper'
You can’t perform that action at this time.
0 commit comments