rouster 0.62 → 0.63

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bce9804eb72b059c106b689793f06a26a55dcdb
4
- data.tar.gz: 278dadb5f13e14a71ea84adecc751989f74ee810
3
+ metadata.gz: 2f6f24bd67f15a77eb224c1d7113697ddf655644
4
+ data.tar.gz: e12f55be25bb6e83b69df057f6f9b5aca70d364e
5
5
  SHA512:
6
- metadata.gz: ae9a583d9d11112ada1f3a17295f41f6d8d5563af4e389af2b1a090f9327a6b5441929199d205bcca341b770e68128cf0514ed7953b154f861651e5d0ab6067e
7
- data.tar.gz: 2f012c9ca78fb82ff64c079ad5e262b77203021e74de3d0e20a1444a20d62633ba7119dbd962b57577fba4f77896930199cd61ba76e9555b85ec1787418fcc23
6
+ metadata.gz: 1dbdd864b27dae6c8de015f027c4935e1ef328ff8a03b22ad6812f6d7b3ee64c99dfe106da9e427e6c7d53d83b09e82484d382df72c2e7c29c4b8a577cfcb515
7
+ data.tar.gz: ce7bbaa357a902683f9ac0d3e2bf5eba3f48c60c50aa9dde5e0d5b7145939ec62d7790ff65eabf6c72c737a28c8bf638bb7feac23a76fa5ffd66618cde0e3e2b
data/Gemfile CHANGED
@@ -6,6 +6,7 @@ gem 'json'
6
6
  gem 'log4r', '~> 1.1.9'
7
7
  gem 'net-scp'
8
8
  gem 'net-ssh'
9
+ gem 'rake', '= 10.4.2'
9
10
 
10
11
  group :development do
11
12
  gem 'test-unit', '~> 3.0.0'
data/Gemfile.lock CHANGED
@@ -52,6 +52,7 @@ GEM
52
52
  nokogiri (1.6.3.1)
53
53
  mini_portile (= 0.6.0)
54
54
  power_assert (0.1.4)
55
+ rake (10.4.2)
55
56
  test-unit (3.0.2)
56
57
  power_assert
57
58
 
@@ -64,4 +65,8 @@ DEPENDENCIES
64
65
  log4r (~> 1.1.9)
65
66
  net-scp
66
67
  net-ssh
68
+ rake (= 10.4.2)
67
69
  test-unit (~> 3.0.0)
70
+
71
+ BUNDLED WITH
72
+ 1.10.6
data/lib/rouster.rb CHANGED
@@ -12,7 +12,7 @@ require 'rouster/vagrant'
12
12
  class Rouster
13
13
 
14
14
  # sporadically updated version number
15
- VERSION = 0.62
15
+ VERSION = 0.63
16
16
 
17
17
  # custom exceptions -- what else do we want them to include/do?
18
18
  class ArgumentError < StandardError; end # thrown by methods that take parameters from users
@@ -24,7 +24,7 @@ class Rouster
24
24
  class PassthroughError < StandardError; end # thrown by anything Passthrough related (mostly vagrant.rb)
25
25
  class SSHConnectionError < StandardError; end # thrown by available_via_ssh() -- and potentially _run()
26
26
 
27
- attr_accessor :facts
27
+ attr_accessor :facts, :last_puppet_run
28
28
  attr_reader :cache, :cache_timeout, :deltas, :exitcode, :logger, :name, :output, :passthrough, :retries, :sshkey, :unittest, :vagrantbinary, :vagrantfile
29
29
 
30
30
  ##
@@ -360,7 +360,7 @@ class Rouster
360
360
  if @ssh.nil? or @ssh.closed?
361
361
  begin
362
362
  res = self.connect_ssh_tunnel()
363
- rescue Rouster::InternalError, Net::SSH::Disconnect => e
363
+ rescue Rouster::InternalError, Net::SSH::Disconnect, Errno::ECONNREFUSED, Errno::ECONNRESET => e
364
364
  res = false
365
365
  end
366
366
 
@@ -518,9 +518,9 @@ class Rouster
518
518
  :osx => '/System/Library/CoreServices/SystemVersion.plist',
519
519
  }
520
520
 
521
- res = nil
521
+ res = :invalid
522
522
 
523
- files.each do |os,file|
523
+ files.each do |os, file|
524
524
  if self.is_file?(file)
525
525
  @logger.debug(sprintf('determined OS to be[%s] via[%s]', os, file))
526
526
  res = os
@@ -528,7 +528,7 @@ class Rouster
528
528
  end
529
529
  end
530
530
 
531
- @logger.error(sprintf('unable to determine OS, looking for[%s]', files)) if res.nil?
531
+ @logger.error(sprintf('unable to determine OS, looking for[%s]', files)) if res.eql?(:invalid)
532
532
 
533
533
  @ostype = res
534
534
  res
@@ -640,7 +640,7 @@ class Rouster
640
640
 
641
641
  if wait
642
642
  inc = wait.to_i / 10
643
- 0..wait.each do |e|
643
+ 0.upto(9) do |e|
644
644
  @logger.debug(sprintf('waiting for reboot: round[%s], step[%s], total[%s]', e, inc, wait))
645
645
  return true if self.is_available_via_ssh?()
646
646
  sleep inc
@@ -476,6 +476,10 @@ class Rouster
476
476
  :systemv => '/sbin/service --status-all',
477
477
  :upstart => 'initctl list',
478
478
  },
479
+
480
+ :invalid => {
481
+ :invalid => 'invalid',
482
+ },
479
483
  }
480
484
 
481
485
  if type.eql?(:all)
@@ -486,7 +490,7 @@ class Rouster
486
490
 
487
491
  type.each do |provider|
488
492
 
489
- raise InternalError.new(sprintf('unable to get service information from VM operating system[%s]', os)) unless commands.has_key?(os)
493
+ raise InternalError.new(sprintf('unable to get service information from VM operating system[%s]', os)) if provider.eql?(:invalid)
490
494
  raise ArgumentError.new(sprintf('unable to find command provider[%s] for [%s]', provider, os)) if commands[os][provider].nil?
491
495
 
492
496
  @logger.info(sprintf('get_services using provider [%s] on [%s]', provider, os))
@@ -665,10 +669,11 @@ class Rouster
665
669
  end
666
670
 
667
671
  end
668
-
669
- # end of os casing
672
+ else
673
+ raise InternalError.new(sprintf('unable to get service information from VM operating system[%s]', os))
670
674
  end
671
675
 
676
+
672
677
  # end of provider processing
673
678
  end
674
679
 
@@ -46,6 +46,27 @@ class Rouster
46
46
  res
47
47
  end
48
48
 
49
+ ##
50
+ # did_exec_fire?
51
+ #
52
+ # given the name of an Exec resource, parse the output from the most recent puppet run
53
+ # and return true/false based on whether the exec in question was fired
54
+ def did_exec_fire?(resource_name, puppet_run = self.last_puppet_run)
55
+ # Notice: /Stage[main]//Exec[foo]/returns: executed successfully
56
+ # Error: /Stage[main]//Exec[bar]/returns: change from notrun to 0 failed: Could not find command '/bin/bar'
57
+ matchers = [
58
+ 'Notice: /Stage\[.*\]//Exec\[%s\]/returns: executed successfully',
59
+ 'Error: /Stage\[.*\]//Exec\[%s\]/returns: change from notrun to 0 failed'
60
+ ]
61
+
62
+ matchers.each do |m|
63
+ matcher = sprintf(m, resource_name)
64
+ return true if puppet_run.match(matcher)
65
+ end
66
+
67
+ false
68
+ end
69
+
49
70
  ##
50
71
  # get_catalog
51
72
  #
@@ -468,7 +489,7 @@ class Rouster
468
489
  cmd << sprintf(' %s', opts[:additional_options]) unless opts[:additional_options].nil?
469
490
  cmd << sprintf(' %s', file)
470
491
 
471
- self.run(cmd, opts[:expected_exitcode])
492
+ self.last_puppet_run = self.run(cmd, opts[:expected_exitcode])
472
493
  end
473
494
  end
474
495
 
@@ -490,7 +511,7 @@ class Rouster
490
511
  cmd << sprintf(' %s', opts[:additional_options]) unless opts[:additional_options].nil?
491
512
  cmd << sprintf(' %s', m)
492
513
 
493
- self.run(cmd, opts[:expected_exitcode])
514
+ self.last_puppet_run = self.run(cmd, opts[:expected_exitcode])
494
515
  end
495
516
 
496
517
  end
@@ -581,13 +581,17 @@ class Rouster
581
581
 
582
582
  when :address
583
583
  lr = Array.new
584
- addresses = ports[expectations[:protocol]][number][:address]
585
- addresses.each_key do |address|
586
- lr.push(address.eql?(v.to_s))
587
- end
588
-
589
- local = ! lr.find{|e| e.true? }.nil? # this feels jankity
584
+ if ports[expectations[:protocol]][number]
585
+ addresses = ports[expectations[:protocol]][number][:address]
586
+ addresses.each_key do |address|
587
+ lr.push(address.eql?(v.to_s))
588
+ end
590
589
 
590
+ local = ! lr.find{|e| e.true? }.nil? # this feels jankity
591
+ else
592
+ # this port isn't open in the first place, won't match any addresses we expect to see it on
593
+ local = false
594
+ end
591
595
  else
592
596
  raise InternalError.new(sprintf('unknown expectation[%s / %s]', k, v))
593
597
  end
@@ -0,0 +1,68 @@
1
+ require sprintf('%s/../../../path_helper', File.dirname(File.expand_path(__FILE__)))
2
+
3
+ require 'rouster'
4
+ require 'rouster/puppet'
5
+ require 'rouster/testing'
6
+ require 'test/unit'
7
+
8
+ class TestValidateFileFunctional < Test::Unit::TestCase
9
+
10
+ # TODO this should probably be further abstracted into the implementation, but this is fine for now
11
+ FLAG_FILES = {
12
+ :ubuntu => '/etc/os-release', # debian too
13
+ :solaris => '/etc/release',
14
+ :redhat => '/etc/redhat-release', # centos too
15
+ :osx => '/System/Library/CoreServices/SystemVersion.plist',
16
+ }
17
+
18
+ def setup
19
+ # expose private methods
20
+ Rouster.send(:public, *Rouster.private_instance_methods)
21
+ Rouster.send(:public, *Rouster.protected_instance_methods)
22
+
23
+ @app = Rouster.new(:name => 'app')
24
+ end
25
+
26
+ def teardown
27
+ # put the flag file back in place
28
+ FLAG_FILES.each_pair do |_os, ff|
29
+ bkup = sprintf('%s.bkup', ff)
30
+ if @app.is_file?(bkup)
31
+ @app.run(sprintf('mv %s %s', bkup, ff))
32
+ end
33
+ end
34
+ end
35
+
36
+ def test_happy_path
37
+
38
+ type = @app.os_type
39
+ assert_not_nil(type, sprintf('unable to determine vm[%s] OS', @app))
40
+ assert_not_equal(:invalid, type)
41
+
42
+ assert_nothing_raised do
43
+ @app.get_services
44
+ end
45
+
46
+ end
47
+
48
+ def test_unhappy_path
49
+ # move the flag file out of the way
50
+ FLAG_FILES.each_pair do |_os, ff|
51
+ if @app.is_file?(ff)
52
+ @app.run(sprintf('mv %s %s.bkup', ff, ff))
53
+ end
54
+ end
55
+
56
+ type = @app.os_type
57
+
58
+ assert_equal(:invalid, type, sprintf('got wrong value for unmarked OS[%s]', type))
59
+
60
+ e = assert_raise do
61
+ @app.get_services
62
+ end
63
+
64
+ assert_equal(Rouster::InternalError, e.class, sprintf('wrong exception raised[%s] [%s]', e.class, e.message))
65
+
66
+ end
67
+
68
+ end
@@ -0,0 +1,59 @@
1
+ Debug: Creating default schedules
2
+ Debug: Using settings: adding file resource 'clientyamldir': 'File[/home/vagrant/.puppet/var/client_yaml]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/var/client_yaml"}'
3
+ Debug: Using settings: adding file resource 'lastrunreport': 'File[/home/vagrant/.puppet/var/state/last_run_report.yaml]{:loglevel=>:debug, :links=>:follow, :ensure=>:file, :backup=>false, :mode=>"640", :path=>"/home/vagrant/.puppet/var/state/last_run_report.yaml"}'
4
+ Debug: Using settings: adding file resource 'confdir': 'File[/home/vagrant/.puppet]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet"}'
5
+ Debug: Using settings: adding file resource 'ssldir': 'File[/home/vagrant/.puppet/ssl]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"771", :path=>"/home/vagrant/.puppet/ssl"}'
6
+ Debug: Using settings: adding file resource 'privatekeydir': 'File[/home/vagrant/.puppet/ssl/private_keys]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/ssl/private_keys"}'
7
+ Debug: Using settings: adding file resource 'client_datadir': 'File[/home/vagrant/.puppet/var/client_data]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/var/client_data"}'
8
+ Debug: Using settings: adding file resource 'statedir': 'File[/home/vagrant/.puppet/var/state]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"1755", :path=>"/home/vagrant/.puppet/var/state"}'
9
+ Debug: Using settings: adding file resource 'vardir': 'File[/home/vagrant/.puppet/var]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet/var"}'
10
+ Debug: Using settings: adding file resource 'libdir': 'File[/home/vagrant/.puppet/var/lib]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet/var/lib"}'
11
+ Debug: Using settings: adding file resource 'publickeydir': 'File[/home/vagrant/.puppet/ssl/public_keys]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet/ssl/public_keys"}'
12
+ Debug: Using settings: adding file resource 'rundir': 'File[/home/vagrant/.puppet/var/run]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"755", :path=>"/home/vagrant/.puppet/var/run"}'
13
+ Debug: Using settings: adding file resource 'privatedir': 'File[/home/vagrant/.puppet/ssl/private]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/ssl/private"}'
14
+ Debug: Using settings: adding file resource 'statefile': 'File[/home/vagrant/.puppet/var/state/state.yaml]{:loglevel=>:debug, :links=>:follow, :ensure=>:file, :backup=>false, :mode=>"660", :path=>"/home/vagrant/.puppet/var/state/state.yaml"}'
15
+ Debug: Using settings: adding file resource 'clientbucketdir': 'File[/home/vagrant/.puppet/var/clientbucket]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/var/clientbucket"}'
16
+ Debug: Using settings: adding file resource 'lastrunfile': 'File[/home/vagrant/.puppet/var/state/last_run_summary.yaml]{:loglevel=>:debug, :links=>:follow, :ensure=>:file, :backup=>false, :mode=>"644", :path=>"/home/vagrant/.puppet/var/state/last_run_summary.yaml"}'
17
+ Debug: Using settings: adding file resource 'logdir': 'File[/home/vagrant/.puppet/var/log]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/var/log"}'
18
+ Debug: Using settings: adding file resource 'certdir': 'File[/home/vagrant/.puppet/ssl/certs]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet/ssl/certs"}'
19
+ Debug: Using settings: adding file resource 'graphdir': 'File[/home/vagrant/.puppet/var/state/graphs]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet/var/state/graphs"}'
20
+ Debug: Using settings: adding file resource 'requestdir': 'File[/home/vagrant/.puppet/ssl/certificate_requests]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet/ssl/certificate_requests"}'
21
+ Debug: /File[/home/vagrant/.puppet/var]: Autorequiring File[/home/vagrant/.puppet]
22
+ Debug: /File[/home/vagrant/.puppet/ssl/certs]: Autorequiring File[/home/vagrant/.puppet/ssl]
23
+ Debug: /File[/home/vagrant/.puppet/var/state]: Autorequiring File[/home/vagrant/.puppet/var]
24
+ Debug: /File[/home/vagrant/.puppet/var/state/graphs]: Autorequiring File[/home/vagrant/.puppet/var/state]
25
+ Debug: /File[/home/vagrant/.puppet/var/state/last_run_report.yaml]: Autorequiring File[/home/vagrant/.puppet/var/state]
26
+ Debug: /File[/home/vagrant/.puppet/var/run]: Autorequiring File[/home/vagrant/.puppet/var]
27
+ Debug: /File[/home/vagrant/.puppet/ssl/certificate_requests]: Autorequiring File[/home/vagrant/.puppet/ssl]
28
+ Debug: /File[/home/vagrant/.puppet/ssl]: Autorequiring File[/home/vagrant/.puppet]
29
+ Debug: /File[/home/vagrant/.puppet/var/state/last_run_summary.yaml]: Autorequiring File[/home/vagrant/.puppet/var/state]
30
+ Debug: /File[/home/vagrant/.puppet/ssl/private_keys]: Autorequiring File[/home/vagrant/.puppet/ssl]
31
+ Debug: /File[/home/vagrant/.puppet/var/client_data]: Autorequiring File[/home/vagrant/.puppet/var]
32
+ Debug: /File[/home/vagrant/.puppet/var/client_yaml]: Autorequiring File[/home/vagrant/.puppet/var]
33
+ Debug: /File[/home/vagrant/.puppet/var/clientbucket]: Autorequiring File[/home/vagrant/.puppet/var]
34
+ Debug: /File[/home/vagrant/.puppet/ssl/private]: Autorequiring File[/home/vagrant/.puppet/ssl]
35
+ Debug: /File[/home/vagrant/.puppet/ssl/public_keys]: Autorequiring File[/home/vagrant/.puppet/ssl]
36
+ Debug: /File[/home/vagrant/.puppet/var/log]: Autorequiring File[/home/vagrant/.puppet/var]
37
+ Debug: /File[/home/vagrant/.puppet/var/state/state.yaml]: Autorequiring File[/home/vagrant/.puppet/var/state]
38
+ Debug: /File[/home/vagrant/.puppet/var/lib]: Autorequiring File[/home/vagrant/.puppet/var]
39
+ Debug: Finishing transaction 69859761088440
40
+ Debug: Loaded state in 0.00 seconds
41
+ Debug: Loaded state in 0.00 seconds
42
+ Info: Applying configuration version '1427151219'
43
+ Debug: /Schedule[daily]: Skipping device resources because running on a host
44
+ Debug: /Schedule[monthly]: Skipping device resources because running on a host
45
+ Debug: /Schedule[hourly]: Skipping device resources because running on a host
46
+ Error: Could not find command '/bin/bar'
47
+ Error: /Stage[main]//Exec[bar]/returns: change from notrun to 0 failed: Could not find command '/bin/bar'
48
+ Debug: /Schedule[never]: Skipping device resources because running on a host
49
+ Debug: /Schedule[weekly]: Skipping device resources because running on a host
50
+ Debug: /Schedule[puppet]: Skipping device resources because running on a host
51
+ Debug: Class[Main]: The container Stage[main] will propagate my refresh event
52
+ Debug: Finishing transaction 69859760392420
53
+ Debug: Storing state
54
+ Debug: Stored state in 0.01 seconds
55
+ Notice: Finished catalog run in 0.10 seconds
56
+ Debug: Using settings: adding file resource 'rrddir': 'File[/home/vagrant/.puppet/var/rrd]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/var/rrd"}'
57
+ Debug: Finishing transaction 69859760156920
58
+ Debug: Received report to process from centos6.internal.salesforce.com
59
+ Debug: Processing report from centos6.internal.salesforce.com with processor Puppet::Reports::Store
@@ -0,0 +1,61 @@
1
+ Debug: Creating default schedules
2
+ Debug: Using settings: adding file resource 'clientyamldir': 'File[/home/vagrant/.puppet/var/client_yaml]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/var/client_yaml"}'
3
+ Debug: Using settings: adding file resource 'lastrunreport': 'File[/home/vagrant/.puppet/var/state/last_run_report.yaml]{:loglevel=>:debug, :links=>:follow, :ensure=>:file, :backup=>false, :mode=>"640", :path=>"/home/vagrant/.puppet/var/state/last_run_report.yaml"}'
4
+ Debug: Using settings: adding file resource 'confdir': 'File[/home/vagrant/.puppet]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet"}'
5
+ Debug: Using settings: adding file resource 'ssldir': 'File[/home/vagrant/.puppet/ssl]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"771", :path=>"/home/vagrant/.puppet/ssl"}'
6
+ Debug: Using settings: adding file resource 'privatekeydir': 'File[/home/vagrant/.puppet/ssl/private_keys]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/ssl/private_keys"}'
7
+ Debug: Using settings: adding file resource 'client_datadir': 'File[/home/vagrant/.puppet/var/client_data]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/var/client_data"}'
8
+ Debug: Using settings: adding file resource 'statedir': 'File[/home/vagrant/.puppet/var/state]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"1755", :path=>"/home/vagrant/.puppet/var/state"}'
9
+ Debug: Using settings: adding file resource 'vardir': 'File[/home/vagrant/.puppet/var]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet/var"}'
10
+ Debug: Using settings: adding file resource 'libdir': 'File[/home/vagrant/.puppet/var/lib]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet/var/lib"}'
11
+ Debug: Using settings: adding file resource 'publickeydir': 'File[/home/vagrant/.puppet/ssl/public_keys]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet/ssl/public_keys"}'
12
+ Debug: Using settings: adding file resource 'rundir': 'File[/home/vagrant/.puppet/var/run]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"755", :path=>"/home/vagrant/.puppet/var/run"}'
13
+ Debug: Using settings: adding file resource 'privatedir': 'File[/home/vagrant/.puppet/ssl/private]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/ssl/private"}'
14
+ Debug: Using settings: adding file resource 'statefile': 'File[/home/vagrant/.puppet/var/state/state.yaml]{:loglevel=>:debug, :links=>:follow, :ensure=>:file, :backup=>false, :mode=>"660", :path=>"/home/vagrant/.puppet/var/state/state.yaml"}'
15
+ Debug: Using settings: adding file resource 'clientbucketdir': 'File[/home/vagrant/.puppet/var/clientbucket]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/var/clientbucket"}'
16
+ Debug: Using settings: adding file resource 'lastrunfile': 'File[/home/vagrant/.puppet/var/state/last_run_summary.yaml]{:loglevel=>:debug, :links=>:follow, :ensure=>:file, :backup=>false, :mode=>"644", :path=>"/home/vagrant/.puppet/var/state/last_run_summary.yaml"}'
17
+ Debug: Using settings: adding file resource 'logdir': 'File[/home/vagrant/.puppet/var/log]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/var/log"}'
18
+ Debug: Using settings: adding file resource 'certdir': 'File[/home/vagrant/.puppet/ssl/certs]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet/ssl/certs"}'
19
+ Debug: Using settings: adding file resource 'graphdir': 'File[/home/vagrant/.puppet/var/state/graphs]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet/var/state/graphs"}'
20
+ Debug: Using settings: adding file resource 'requestdir': 'File[/home/vagrant/.puppet/ssl/certificate_requests]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :path=>"/home/vagrant/.puppet/ssl/certificate_requests"}'
21
+ Debug: /File[/home/vagrant/.puppet/var]: Autorequiring File[/home/vagrant/.puppet]
22
+ Debug: /File[/home/vagrant/.puppet/ssl/certs]: Autorequiring File[/home/vagrant/.puppet/ssl]
23
+ Debug: /File[/home/vagrant/.puppet/var/state]: Autorequiring File[/home/vagrant/.puppet/var]
24
+ Debug: /File[/home/vagrant/.puppet/var/state/graphs]: Autorequiring File[/home/vagrant/.puppet/var/state]
25
+ Debug: /File[/home/vagrant/.puppet/var/state/last_run_report.yaml]: Autorequiring File[/home/vagrant/.puppet/var/state]
26
+ Debug: /File[/home/vagrant/.puppet/var/run]: Autorequiring File[/home/vagrant/.puppet/var]
27
+ Debug: /File[/home/vagrant/.puppet/ssl/certificate_requests]: Autorequiring File[/home/vagrant/.puppet/ssl]
28
+ Debug: /File[/home/vagrant/.puppet/ssl]: Autorequiring File[/home/vagrant/.puppet]
29
+ Debug: /File[/home/vagrant/.puppet/var/state/last_run_summary.yaml]: Autorequiring File[/home/vagrant/.puppet/var/state]
30
+ Debug: /File[/home/vagrant/.puppet/ssl/private_keys]: Autorequiring File[/home/vagrant/.puppet/ssl]
31
+ Debug: /File[/home/vagrant/.puppet/var/client_data]: Autorequiring File[/home/vagrant/.puppet/var]
32
+ Debug: /File[/home/vagrant/.puppet/var/client_yaml]: Autorequiring File[/home/vagrant/.puppet/var]
33
+ Debug: /File[/home/vagrant/.puppet/var/clientbucket]: Autorequiring File[/home/vagrant/.puppet/var]
34
+ Debug: /File[/home/vagrant/.puppet/ssl/private]: Autorequiring File[/home/vagrant/.puppet/ssl]
35
+ Debug: /File[/home/vagrant/.puppet/ssl/public_keys]: Autorequiring File[/home/vagrant/.puppet/ssl]
36
+ Debug: /File[/home/vagrant/.puppet/var/log]: Autorequiring File[/home/vagrant/.puppet/var]
37
+ Debug: /File[/home/vagrant/.puppet/var/state/state.yaml]: Autorequiring File[/home/vagrant/.puppet/var/state]
38
+ Debug: /File[/home/vagrant/.puppet/var/lib]: Autorequiring File[/home/vagrant/.puppet/var]
39
+ Debug: Finishing transaction 69859761088440
40
+ Debug: Loaded state in 0.00 seconds
41
+ Debug: Loaded state in 0.00 seconds
42
+ Info: Applying configuration version '1427151219'
43
+ Debug: /Schedule[daily]: Skipping device resources because running on a host
44
+ Debug: /Schedule[monthly]: Skipping device resources because running on a host
45
+ Debug: /Schedule[hourly]: Skipping device resources because running on a host
46
+ Debug: Exec[foo](provider=posix): Executing '/bin/echo foo'
47
+ Debug: Executing '/bin/echo foo'
48
+ Notice: /Stage[main]//Exec[foo]/returns: executed successfully
49
+ Debug: /Stage[main]//Exec[foo]: The container Class[Main] will propagate my refresh event
50
+ Debug: /Schedule[never]: Skipping device resources because running on a host
51
+ Debug: /Schedule[weekly]: Skipping device resources because running on a host
52
+ Debug: /Schedule[puppet]: Skipping device resources because running on a host
53
+ Debug: Class[Main]: The container Stage[main] will propagate my refresh event
54
+ Debug: Finishing transaction 69859760392420
55
+ Debug: Storing state
56
+ Debug: Stored state in 0.01 seconds
57
+ Notice: Finished catalog run in 0.10 seconds
58
+ Debug: Using settings: adding file resource 'rrddir': 'File[/home/vagrant/.puppet/var/rrd]{:loglevel=>:debug, :links=>:follow, :ensure=>:directory, :backup=>false, :mode=>"750", :path=>"/home/vagrant/.puppet/var/rrd"}'
59
+ Debug: Finishing transaction 69859760156920
60
+ Debug: Received report to process from centos6.internal.salesforce.com
61
+ Debug: Processing report from centos6.internal.salesforce.com with processor Puppet::Reports::Store
@@ -0,0 +1,44 @@
1
+ require sprintf('%s/../../../path_helper', File.dirname(File.expand_path(__FILE__)))
2
+
3
+ require 'rouster'
4
+ require 'rouster/puppet'
5
+ require 'test/unit'
6
+
7
+ # this is a unit test, no need for a real Rouster VM
8
+
9
+ class TestGetPuppetStar < Test::Unit::TestCase
10
+
11
+ def setup
12
+ assert_nothing_raised do
13
+ @app = Rouster.new(:name => 'app', :unittest => true)
14
+ end
15
+
16
+ # expose private methods
17
+ Rouster.send(:public, *Rouster.protected_instance_methods)
18
+ end
19
+
20
+ def test_with_successful_exec
21
+ title = 'foo'
22
+ input = File.read(sprintf('%s/../../../test/unit/puppet/resources/puppet_run_with_successful_exec', File.dirname(File.expand_path(__FILE__))))
23
+
24
+
25
+ assert(@app.did_exec_fire?(title, input))
26
+ end
27
+
28
+ def test_with_failed_exec
29
+ title = 'bar'
30
+ input = File.read(sprintf('%s/../../../test/unit/puppet/resources/puppet_run_with_failed_exec', File.dirname(File.expand_path(__FILE__))))
31
+
32
+ assert(@app.did_exec_fire?(title, input))
33
+ end
34
+
35
+ def test_looking_for_nonexistent_exec
36
+ title = 'fizzbang'
37
+ input = File.read(sprintf('%s/../../../test/unit/puppet/resources/puppet_run_with_successful_exec', File.dirname(File.expand_path(__FILE__))))
38
+
39
+ assert_false(@app.did_exec_fire?(title, input))
40
+ end
41
+
42
+
43
+ end
44
+
@@ -91,6 +91,11 @@ class TestValidatePort < Test::Unit::TestCase
91
91
 
92
92
  end
93
93
 
94
+ def test_negative_port_dne
95
+ assert_equal(false, @app.validate_port(4567, { :ensure => true, :address => '*' }))
96
+ assert_equal(false, @app.validate_port(4567, { :ensure => true, :address => '127.0.0.1' }))
97
+ end
98
+
94
99
  def teardown
95
100
  # noop
96
101
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rouster
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.62'
4
+ version: '0.63'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Conor Horan-Kates
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-14 00:00:00.000000000 Z
11
+ date: 2016-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -141,6 +141,7 @@ files:
141
141
  - test/basic.rb
142
142
  - test/functional/deltas/test_get_crontab.rb
143
143
  - test/functional/deltas/test_get_groups.rb
144
+ - test/functional/deltas/test_get_os.rb
144
145
  - test/functional/deltas/test_get_packages.rb
145
146
  - test/functional/deltas/test_get_ports.rb
146
147
  - test/functional/deltas/test_get_services.rb
@@ -172,7 +173,10 @@ files:
172
173
  - test/puppet/modules/role/manifests/ui.pp
173
174
  - test/puppet/test_apply.rb
174
175
  - test/tunnel_vs_scp.rb
176
+ - test/unit/puppet/resources/puppet_run_with_failed_exec
177
+ - test/unit/puppet/resources/puppet_run_with_successful_exec
175
178
  - test/unit/puppet/test_get_puppet_star.rb
179
+ - test/unit/puppet/test_puppet_parsing.rb
176
180
  - test/unit/test_generate_unique_mac.rb
177
181
  - test/unit/test_new.rb
178
182
  - test/unit/test_parse_ls_string.rb
@@ -209,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
213
  version: 1.3.6
210
214
  requirements: []
211
215
  rubyforge_project: Rouster
212
- rubygems_version: 2.4.6
216
+ rubygems_version: 2.4.8
213
217
  signing_key:
214
218
  specification_version: 4
215
219
  summary: Rouster is an abstraction layer for Vagrant