syncwrap 2.7.0 → 2.7.1

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: d848cc57d0687947e9b350e86f3b581088572c42
4
- data.tar.gz: fbbf0ae54fe44d9e14162f7e2ebef65c070fd065
3
+ metadata.gz: 5896d57fe2fbc03aa1b81254619ed604b37ae513
4
+ data.tar.gz: 8764f0567918f0872297bda1802f179ece696b56
5
5
  SHA512:
6
- metadata.gz: d5647f57c02531435bced8dcb1373976fadaa162859bb7cf1c3e2bcc683dcb9b672b0ce6a6d4380712b93e68bf2be07257bd5fe5ac519e4beccec9de6593325a
7
- data.tar.gz: 2914e8ec77e1c763c6c164a1b7df19bfc27a7c8ac536b1c207f4703dda71e40013bf3f5265e35fc25939920cfc98c4b6209654343cb01b807f68ac0677a09184
6
+ metadata.gz: a60f4f82c141f4aa2fe773b9a3e484123c8d02333130bf1a59c56df2dd6fe203adf03ff01926f3cdb4f9e4968ebe871ebb671ca914805117ae85a2ad888c33b4
7
+ data.tar.gz: c3fbff10f3100aa06ab58e0dc286bd29957256e9220f14d036432aaded32f85e681d2a7e078ad07037c30304b8483cf86672b3175536db40b2b6e35293ca8a86
data/History.rdoc CHANGED
@@ -1,3 +1,14 @@
1
+ === 2.7.1 (2016-3-2)
2
+ * Fix handling of the -R/--components-in-role flag to correctly limit
3
+ to hosts including the role, for both execution and listing
4
+ (-l). Previously errors would occur in execution if a
5
+ matching (-h) host pattern restriction was not also provided.
6
+ * Fix interpretation of check_install and (deprecated) succeed options
7
+ when used in calls to dist_install (all distros).
8
+ * Avoid check_install on RHEL when local rpm files or URLs are passed
9
+ as a package to install. Previously the check_install conditional
10
+ would always yield true (install needed) for these.
11
+
1
12
  === 2.7.0 (2016-1-21)
2
13
  * Add SyncWrap::ZoneBalancer utility for balancing new hosts across
3
14
  multiple (AWS) availability zones for fault tolerance.
data/lib/syncwrap/base.rb CHANGED
@@ -15,7 +15,7 @@
15
15
  #++
16
16
 
17
17
  module SyncWrap
18
- VERSION='2.7.0'
18
+ VERSION='2.7.1'
19
19
 
20
20
  GEM_ROOT = File.dirname(File.dirname(File.dirname(__FILE__))) # :nodoc:
21
21
  end
data/lib/syncwrap/cli.rb CHANGED
@@ -304,6 +304,7 @@ TEXT
304
304
  def list_roles( hosts, multi )
305
305
  puts "Included Roles:" if multi
306
306
  roles = hosts.map( &:roles ).inject([],:|)
307
+ roles &= @comp_roles if !@comp_roles.empty?
307
308
  table = roles.map do |role|
308
309
  row = [ ':' + role.to_s ]
309
310
  classes = space.role( role ).map( &:class )
@@ -404,6 +405,12 @@ TEXT
404
405
  host.roles.any? { |r| @roles.include?( r ) }
405
406
  end
406
407
  end
408
+
409
+ unless @comp_roles.empty?
410
+ @hosts.select! do |host|
411
+ host.roles.any? { |r| @comp_roles.include?( r ) }
412
+ end
413
+ end
407
414
  end
408
415
 
409
416
  end
@@ -42,7 +42,8 @@ module SyncWrap
42
42
  opts = pkgs.last.is_a?( Hash ) && pkgs.pop.dup || {}
43
43
  opts.delete( :minimal )
44
44
  pkgs.flatten!
45
- chk = opts.delete( :check_install ) || opts.delete( :succeed )
45
+ chk = opts.delete( :check_install )
46
+ chk = opts.delete( :succeed ) if chk.nil?
46
47
  chk = check_install? if chk.nil?
47
48
  dist_if_not_installed?( pkgs, chk, opts ) do
48
49
  sudo( "pacman -S --noconfirm #{pkgs.join ' '}", opts )
@@ -66,7 +66,8 @@ module SyncWrap
66
66
  args.flatten!
67
67
  flags = []
68
68
  flags << '--no-install-recommends' if opts.delete( :minimal )
69
- chk = opts.delete( :check_install ) || opts.delete( :succeed )
69
+ chk = opts.delete( :check_install )
70
+ chk = opts.delete( :succeed ) if chk.nil?
70
71
  chk = check_install? if chk.nil?
71
72
  dist_if_not_installed?( args, chk, opts ) do
72
73
  sudo( "apt-get -yqq update", opts ) if first_apt?
@@ -56,7 +56,8 @@ module SyncWrap
56
56
  opts = pkgs.last.is_a?( Hash ) && pkgs.pop.dup || {}
57
57
  opts.delete( :minimal )
58
58
  pkgs.flatten!
59
- chk = opts.delete( :check_install ) || opts.delete( :succeed )
59
+ chk = opts.delete( :check_install )
60
+ chk = opts.delete( :succeed ) if chk.nil?
60
61
  chk = check_install? if chk.nil?
61
62
  dist_if_not_installed?( pkgs, chk, opts ) do
62
63
  sudo( "yum install -q -y #{pkgs.join( ' ' )}", opts )
@@ -90,7 +91,7 @@ module SyncWrap
90
91
  # testing if any specified pkgs are not installed. Otherwise just
91
92
  # yield to block.
92
93
  def dist_if_not_installed?( pkgs, chk, opts, &block )
93
- if chk
94
+ if chk && pkgs.all? { |p| p !~ /\.rpm$/ && p !~ /^http(s)?:/ }
94
95
  qry = "yum list -C -q installed #{pkgs.join ' '}"
95
96
  cnt = qry + " | tail -n +2 | wc -l"
96
97
  cond = %Q{if [ "$(#{cnt})" != "#{pkgs.count}" ]; then}
data/lib/syncwrap/host.rb CHANGED
@@ -104,12 +104,10 @@ module SyncWrap
104
104
  end
105
105
  end
106
106
 
107
- # Returns components under the specified role
108
- def components_in_roles( roles )
109
- roles.inject([]) do |m,r|
110
- m += space.role( r ) if roles.include?( r )
111
- m
112
- end
107
+ # Returns components instances under the specified roles for this
108
+ # host
109
+ def components_in_roles( qroles )
110
+ ( qroles & roles ).inject([]) { |m,r| m += space.role( r ) }
113
111
  end
114
112
 
115
113
  # Return the last component added to this Host prior to the given
data/test/test_space.rb CHANGED
@@ -100,13 +100,16 @@ class TestSpace < MiniTest::Unit::TestCase
100
100
  def test_host_direct_components
101
101
  c1 = CompOne.new
102
102
  c2 = CompTwo.new
103
+ c3 = CompThree.new
103
104
  sp.role( :test, c2 )
105
+ sp.role( :alt, c3 )
104
106
  assert_equal( [ c2 ], sp.role( :test ) )
105
107
 
106
108
  c2b = CompTwo.new
107
109
  host = sp.host( 'localhost', c1, :test, c2b )
108
110
  assert_equal( [ c1, c2, c2b ], host.components )
109
111
  assert_equal( [ c2 ], host.components_in_roles( [ :test ] ) )
112
+ assert_equal( [], host.components_in_roles( [ :alt ] ) )
110
113
  assert_equal( c1, host.component( CompOne ) )
111
114
  assert_equal( c2b, host.component( CompTwo ) ) #last instance
112
115
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syncwrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Kellum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-21 00:00:00.000000000 Z
11
+ date: 2016-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: term-ansicolor