ansible-powerplay 1.1.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semver +1 -1
- data/README.org +12 -0
- data/RELEASE_NOTES.org +1 -0
- data/ansible-powerplay.gemspec +3 -3
- data/lib/ansible-powerplay/cli.rb +22 -2
- data/lib/ansible-powerplay/powerplay.rb +27 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4190194915cad33eb4578e63fd965b9ac87431d1
|
4
|
+
data.tar.gz: d3d3e3289b5e4232c68d0f33fc5dd1d9bfeca75b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cda9fb902dfa37287191a1d097f8522ee593297b425eacfaa3deae1ac5a1cca81160568acf90c763761c345d4eb689741127cb5ee05f3a8d1535166b8ae36291
|
7
|
+
data.tar.gz: 8f53c342b3c3d36bea51d8833079e424461f9b58d7d97588c49cda84773e5417783d8fde67b8bc4026639bfaa46f6f0eb1fdaa72a5d08c1e665883a4930e8525
|
data/.semver
CHANGED
data/README.org
CHANGED
@@ -550,3 +550,15 @@ Description:
|
|
550
550
|
group_threads.each{ |t| t.join }
|
551
551
|
end
|
552
552
|
#+end_src
|
553
|
+
*** Old tmux option parsing functional
|
554
|
+
#+begin_src ruby
|
555
|
+
.inspect
|
556
|
+
.chop
|
557
|
+
.split(",")
|
558
|
+
.map{ |s| s.strip.sub(/\\n|\"/, '') }
|
559
|
+
.reject{ |pty| pty == %x(tty).chop }
|
560
|
+
.reject{ |pty| pty == '' }
|
561
|
+
#+end_src
|
562
|
+
|
563
|
+
|
564
|
+
|
data/RELEASE_NOTES.org
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
** Release Notes
|
10
10
|
| Release | Feature / Bug | Description | Date |
|
11
11
|
|---------+----------------------------------------+-----------------------------------------------------------------------------------------------+------------|
|
12
|
+
| v1.2.0 | Tmux pane numbering | Allows you to specify precisely which panes on your target window that will receive the dump. | 2016-09-01 |
|
12
13
|
| v1.1.0 | Group sequencing | Allows you to run a group multiple times with sequence numbers. | 2016-08-09 |
|
13
14
|
| v1.0.8 | --ttys | List specific terminals you'd like the output to go to. | 2016-07-07 |
|
14
15
|
| v1.0.7 | Verosity Switch --apverbose=n (-Vn) | Pass to ansible-powerplay -v, -vv, etc. | |
|
data/ansible-powerplay.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
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 1.
|
5
|
+
# stub: ansible-powerplay 1.3.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "ansible-powerplay"
|
9
|
-
s.version = "1.
|
9
|
+
s.version = "1.3.0"
|
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"]
|
13
13
|
s.authors = ["Fred Mitchell"]
|
14
|
-
s.date = "2016-
|
14
|
+
s.date = "2016-09-01"
|
15
15
|
s.description = "Ansible Powerplay, by way of its DSL, allows you to\n specify your Ansible playbooks and their vars, and common\n vars to all, so that you can run your\n indeoendent playbooks in full parallel."
|
16
16
|
s.email = "fred.mitchell@gmx.de"
|
17
17
|
s.executables = ["powerplay", "pp"]
|
@@ -17,8 +17,28 @@ module Powerplay
|
|
17
17
|
if [script] is not given, it defaults to 'stack.play'
|
18
18
|
in the current directory.
|
19
19
|
LONGDESC
|
20
|
-
option :tmux, type: :
|
21
|
-
desc:
|
20
|
+
option :tmux, type: :string, aliases: '-m', banner: "[WINDOWNUMBERopt[:PANENUMBER[,PANENUMBER...]]]", lazy_default: "0",
|
21
|
+
desc: <<-LONGDESC
|
22
|
+
|
23
|
+
Send output to all tmux panes in the current window, or the numeric
|
24
|
+
window specified. Additionally, you can precisely specify pane indices,
|
25
|
+
as are shown by the "<tmux-key> q" command (or whatever you may have
|
26
|
+
mapped it to.
|
27
|
+
|
28
|
+
Examples:
|
29
|
+
-m -- will send the output to "random" panes of the current TMUX
|
30
|
+
window.
|
31
|
+
-m=2 -- will send the output to the TMUX window two, and "randomly"
|
32
|
+
select panes for the output.
|
33
|
+
-m=2:2,3 -- will send the outputs to only pane indices 2 and 3 of TMUX window 2.
|
34
|
+
-m=0:1,4 -- will send the outputs to only pane indices 1 and 4 of the current
|
35
|
+
TMUX window. '0' always mean 'current TMUX window'.
|
36
|
+
|
37
|
+
Note that you will need to use the '=' now, when you specify windows and panes.
|
38
|
+
It will not work properly without it.
|
39
|
+
|
40
|
+
LONGDESC
|
41
|
+
|
22
42
|
option :ttys, type: :array, aliases: '-M', banner: "[TTY1[ TTY2 ...]]",
|
23
43
|
desc: ' Send output to specified (pseudo) ttys.'
|
24
44
|
option :play, type: :array, aliases: ['-p', '--power'], banner: "[NAME[ NAME2...]|all]", required: true,
|
@@ -14,28 +14,45 @@ module Powerplay
|
|
14
14
|
%x[tty].chop
|
15
15
|
end
|
16
16
|
|
17
|
+
# Either this list is empty, or a list
|
18
|
+
# of window indices that was passed in from command-line.
|
19
|
+
def self.list_of_pane_indices
|
20
|
+
@slst ||= Play::clopts[:tmux].split(':')[1]
|
21
|
+
@lst ||= unless @slst.nil?
|
22
|
+
@slst
|
23
|
+
.split(',')
|
24
|
+
.map{ |n| n.to_i }
|
25
|
+
else
|
26
|
+
[]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
17
30
|
# Get a list of the ptys
|
18
31
|
# Note that this code is a bit innefficient, but will only be
|
19
32
|
# executed once in the loop.
|
20
33
|
def self.pane_ttys
|
21
|
-
@window = if Play::clopts.nil? or Play::clopts[:tmux] == 0
|
34
|
+
@window = if Play::clopts.nil? or Play::clopts[:tmux].split(':').first.to_i == 0
|
22
35
|
''
|
23
36
|
else
|
24
|
-
" -t #{Play::clopts[:tmux]} "
|
37
|
+
" -t #{Play::clopts[:tmux].split(':').first} "
|
25
38
|
end
|
26
39
|
@ptys ||= if Play::clopts[:ttys]
|
27
40
|
Play::clopts[:ttys]
|
28
41
|
elsif Play::clopts.nil? or Play::clopts[:tmux]
|
29
|
-
%x[tmux list-panes #{@window} -F '\#{pane_tty},']
|
42
|
+
%x[tmux list-panes #{@window} -F '\#{pane_index}:\#{pane_tty},']
|
30
43
|
.inspect
|
31
44
|
.chop
|
32
|
-
.split(
|
45
|
+
.split(',')
|
33
46
|
.map{ |s| s.strip.sub(/\\n|\"/, '') }
|
34
|
-
.reject{ |pty| pty == %x(tty).chop }
|
35
47
|
.reject{ |pty| pty == '' }
|
48
|
+
.map{ |s| s.split(':') }
|
49
|
+
.reject{ |idx,pty| pty == '' }
|
50
|
+
.map{ |i,t| [i.to_i, t] }
|
51
|
+
.reject{ |i,pty| not (list_of_pane_indices.empty? or list_of_pane_indices.member?(i)) }
|
52
|
+
.to_h
|
36
53
|
else
|
37
|
-
|
38
|
-
end
|
54
|
+
{nur: current_tty}
|
55
|
+
end
|
39
56
|
end
|
40
57
|
|
41
58
|
# thread-safe way to grab a new tty
|
@@ -44,7 +61,7 @@ module Powerplay
|
|
44
61
|
CRITICAL.synchronize {
|
45
62
|
@@tty_count ||= -1
|
46
63
|
@@tty_count = (@@tty_count+1) % pane_ttys.size
|
47
|
-
tty = pane_ttys[@@tty_count]
|
64
|
+
tty = pane_ttys.values[@@tty_count]
|
48
65
|
}
|
49
66
|
tty
|
50
67
|
end
|
@@ -85,7 +102,7 @@ module Powerplay
|
|
85
102
|
extra = Play::clopts[:extra]
|
86
103
|
tags = Play::clopts[:tags]
|
87
104
|
sktags = Play::clopts[:sktags]
|
88
|
-
tmuxout = Play::clopts[:tmux]
|
105
|
+
tmuxout, tmuxpanes = Play::clopts[:tmux]
|
89
106
|
apverb = Play::clopts[:apverbose]
|
90
107
|
|
91
108
|
verb = (apverb == 0) ? '' : ('-' + ('v' * apverb))
|
@@ -97,7 +114,7 @@ module Powerplay
|
|
97
114
|
tagstr += %( --tags "#{tags}" ) unless tags.nil?
|
98
115
|
tagstr += %( --skip-tags "#{sktags}" ) unless sktags.nil?
|
99
116
|
tty ||= Tmux.grab_a_tty
|
100
|
-
puts " tty == #{tty} (#{Tmux.pane_ttys.last})" unless DSL::_verbosity < 2
|
117
|
+
puts " tty == #{tty} (#{Tmux.pane_ttys.values.last})" unless DSL::_verbosity < 2
|
101
118
|
if (book.type != :noop) and
|
102
119
|
(bucher.first == :all or bucher.member?(book.type)) and
|
103
120
|
(grouppe.first == :all or not (grouppe & book.family).empty?)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ansible-powerplay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Mitchell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|