fissher 1.0.3 → 1.0.4

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.
data/README.rdoc CHANGED
@@ -6,17 +6,17 @@ Fissher is a simple utility to run commands on multiple servers, powered by Net:
6
6
  === Usage
7
7
 
8
8
  fissher [flags] [command]:
9
- -G Hostgroup Execute command on all hosts listed in the JSON config for
10
- the specified group.
11
- -H Host1,Host2 Execute command on hosts listed on the command line
12
- -g jumpbox Manually specify/override a jump server, if necessary.
13
- -s Execute the provided commands with sudo.
14
- -u username Manually specify/override username to connect with.
15
- -p Use password based authentication, specified via STDIN
16
- -c config.json Manually specify the path to your fissher config file
17
- -n num Number of concurrent connections. Enter 0 for unlimited.
18
- -U username Specify an alternate user in conjunction with -s
19
- (E.G. -U webmaster)
9
+ -G Hostgroup Execute command on all hosts listed in the JSON config for
10
+ the specified group.
11
+ -H Host1,Host2 Execute command on hosts listed on the command line
12
+ -g jumpbox Manually specify/override a jump server, if necessary.
13
+ -s Execute the provided commands with sudo.
14
+ -u username Manually specify/override username to connect with.
15
+ -p Use password based authentication, specified via STDIN
16
+ -c config.json Manually specify the path to your fissher config file
17
+ -n num Number of concurrent connections. Enter 0 for unlimited.
18
+ -U username Specify an alternate user to run the command as. Uses sudo.
19
+ (E.G. -U webmaster)
20
20
 
21
21
  === Installation
22
22
 
@@ -24,7 +24,10 @@ Fissher is a simple utility to run commands on multiple servers, powered by Net:
24
24
 
25
25
  Simply run the following:
26
26
 
27
- gem install fissher
27
+ gem install fissher
28
+
29
+ {<img src="https://badge.fury.io/rb/fissher.png" alt="Gem Version" />}[http://badge.fury.io/rb/fissher]
30
+
28
31
 
29
32
  ==== Manual
30
33
 
data/lib/fissher_base.rb CHANGED
@@ -13,7 +13,7 @@ class FissherBase
13
13
  opts = FissherConf.handle_opts unless !opts.nil?
14
14
  abort "No hosts specified! Please use -H or -G!\n" unless !opts[:hostlist].nil?
15
15
 
16
- Net::SSH::Multi.start(:concurrent_connections => opts[:concurrency]) do |session|
16
+ Net::SSH::Multi.start(:concurrent_connections => opts[:concurrency], :on_error => :warn) do |session|
17
17
  if opts[:gateway]
18
18
  session.via opts[:gateway], opts[:user], :password => opts[:password]
19
19
  end
@@ -42,7 +42,7 @@ class FissherBase
42
42
  end
43
43
  end
44
44
  end
45
- end
45
+ end
46
46
  else
47
47
  # Sudo isn't needed. We don't need a PTY.
48
48
  session.exec(opts[:command])
data/lib/fissher_conf.rb CHANGED
@@ -39,18 +39,20 @@ module FissherConf
39
39
  # Print usage message
40
40
  def usage
41
41
  app = File.basename($0)
42
- puts "#{app} [flags] [command]:\n"
43
- puts "-G Hostgroup Execute command on all hosts listed in the JSON config for \n"
44
- puts " the specified group.\n"
45
- puts "-H Host1,Host2 Execute command on hosts listed on the command line\n"
46
- puts "-g jumpbox Manually specify/override a jump server, if necessary.\n"
47
- puts "-s Execute the provided commands with sudo."
48
- puts "-u username Manually specify/override username to connect with.\n"
49
- puts "-p Use password based authentication, specified via STDIN\n"
50
- puts "-c config.json Manually specify the path to your fissher config file\n"
51
- puts "-n num Number of concurrent connections. Enter 0 for unlimited.\n"
52
- puts "-U username Specify an alternate user in conjunction with -s\n"
53
- puts " (E.G. -U webmaster)\n"
42
+ puts <<-EOF
43
+ #{app} [flags] [command]:
44
+ -G Hostgroup Execute command on all hosts listed in the JSON config for
45
+ the specified group.
46
+ -H Host1,Host2 Execute command on hosts listed on the command line
47
+ -g jumpbox Manually specify/override a jump server, if necessary.
48
+ -s Execute the provided commands with sudo.
49
+ -u username Manually specify/override username to connect with.
50
+ -p Use password based authentication, specified via STDIN
51
+ -c config.json Manually specify the path to your fissher config file
52
+ -n num Number of concurrent connections. Enter 0 for unlimited.
53
+ -U username Specify an alternate user to run the command as. Uses sudo.
54
+ (E.G. -U webmaster)
55
+ EOF
54
56
  end
55
57
 
56
58
  # A shortcut method to make errors a little more graceful.
@@ -108,13 +110,14 @@ EOB
108
110
  abort
109
111
  end
110
112
 
113
+
111
114
  # Use sudo for our command
112
115
  if opt["s"]
113
- if opt["U"]
114
- sudo_cmd = "sudo -u #{opt['U']}"
115
- else
116
- sudo_cmd = "sudo"
117
- end
116
+ sudo_cmd = "sudo"
117
+ end
118
+
119
+ if opt["U"] #&& opt["s"].nil?
120
+ sudo_cmd = "sudo -u #{opt['U']}"
118
121
  end
119
122
 
120
123
  # Gateway if an edgeserver is present
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fissher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-02 00:00:00.000000000 Z
12
+ date: 2013-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-ssh-multi