ansible-powerplay 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9dd462851801b5fa3560bf9b8dd5f08c0d80728
4
- data.tar.gz: ec3da1aaf3afb7fbff91780979630e703aa9591c
3
+ metadata.gz: 88303d0e049d649b8d969e872a412cffc9d96162
4
+ data.tar.gz: ffc30cbff29524a0a3abdf69d8362b02e1d05981
5
5
  SHA512:
6
- metadata.gz: 016606a083317be2b29d41c09c11a229163de64813236f1f047f6d6ae9579ad08295ab58f286dbc4300ddef4cdb4f5fcfcf56666c1efe78f2f4a152cd5c41fac
7
- data.tar.gz: b7415bda872425c58cb4c022968dd7b33a858d065d42d9693b3a61f9d7bcae3548c7feec1c9a9ce0e579310b8b8dcadf68a5c78fcdd8bb65f878d4e693c623a7
6
+ metadata.gz: 31e69ea4973bb82ef4e4e6318ca7eb55aea56b1905bda91ee4b88bcd2df385b2ebf46c67e92428f9461bac505528516bc567d34bf4d3550ee80f98701538893b
7
+ data.tar.gz: 454af5e1e9112a5cdfddd017aa68598fbdef398091a726120f40bb7dca0cd225fe03e8b51449757c603e03fe3e828dbcaebf530dbb7f7acf3ee29f255e944baf
data/.semver CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 4
4
+ :patch: 5
5
5
  :special: ''
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: ansible-powerplay 0.0.4 ruby lib
5
+ # stub: ansible-powerplay 0.0.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "ansible-powerplay"
9
- s.version = "0.0.4"
9
+ s.version = "0.0.5"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -16,6 +16,7 @@ module Powerplay
16
16
  option :tmux, type: :boolean, aliases: '-m', banner: "send output to all tmux panes in the current window"
17
17
  option :play, type: :string, banner: "[NAME|all] Which playbook shelf", required: true
18
18
  option :group, type: :string, banner: "[NAME|all] Which group to execute", default: "all"
19
+ option :congroups, type: :boolean, aliases: '-c', banner: "Run the groups themselves concurrently"
19
20
  option :book, type: :string, banner: "[NAME|all] Which book to execute", default: "all"
20
21
  option :dryrun, type: :boolean, banner: "Dry run, do not actually execute."
21
22
  def play(script)
@@ -50,36 +50,43 @@ module Powerplay
50
50
  def self.power_run
51
51
  buch = Play::clopts[:book].to_sym
52
52
  dryrun = Play::clopts[:dryrun]
53
-
53
+ congroups = Play::clopts[:congroups]
54
54
  playbooks do |pname, playbook|
55
+ thrgroups = []
55
56
  puts "PLAYBOOK #{pname} (group=#{Play::clopts[:group]}) -->"
56
57
  groups playbook do |group|
57
- puts " GROUP #{group.type} (book=#{buch}) -->"
58
- thrs = []
59
- errors = []
60
- group.books.zip(Tmux.pane_ptys) do |book, tty|
61
- tty ||= Tmux.pane_ptys.last
62
- if buch == :all or book.type == buch
63
- puts " BOOK #{book.type}"
64
- apcmd = %|#{PLAYBOOK} #{OPTS} #{book.config[:playbook_directory].first}/#{book.yaml} --extra-vars "#{book.aparams}" >#{tty}|
65
- thrs << Thread.new {
66
- std, status = Open3.capture2e apcmd
67
- errors << [book.yaml, apcmd, std] unless status.success?
68
- } unless dryrun
58
+ tg = nil
59
+ thrgroups << (tg = Thread.new {
60
+ puts " GROUP #{group.type} (book=#{buch}, cg=#{congroups}) -->"
61
+ thrbooks = []
62
+ errors = []
63
+ group.books.zip(Tmux.pane_ptys) do |book, tty|
64
+ tty ||= Tmux.pane_ptys.last
65
+ if buch == :all or book.type == buch
66
+ puts " BOOK #{book.type}"
67
+ apcmd = %|#{PLAYBOOK} #{OPTS} #{book.config[:playbook_directory].first}/#{book.yaml} --extra-vars "#{book.aparams}" >#{tty}|
68
+ thrbooks << Thread.new {
69
+ std, status = Open3.capture2e apcmd
70
+ errors << [book.yaml, apcmd, std] unless status.success?
71
+ } unless dryrun
72
+ end
69
73
  end
70
- end
71
- thrs.each{ |t| t.join }
72
- unless errors.empty?
73
- errors.each do |yaml, cmd, txt|
74
- puts '=' * 30
75
- puts ('*' * 10) + ' ' + yaml
76
- puts txt
77
- puts '-' * 30
78
- puts cmd
74
+ thrbooks.each{ |t| t.join }
75
+ unless errors.empty?
76
+ errors.each do |yaml, cmd, txt|
77
+ puts '=' * 30
78
+ puts ('*' * 10) + ' ' + yaml
79
+ puts txt
80
+ puts '-' * 30
81
+ puts cmd
82
+ end
83
+ exit 10
79
84
  end
80
- exit 10
81
- end
85
+ })
86
+ # Always wait here unless we're concurrent
87
+ thrgroups.join unless congroups
82
88
  end
89
+ thrgroups.each{ |t| t.join }
83
90
  end
84
91
  end
85
92
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ansible-powerplay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Mitchell