consolr 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/consolr/version.rb +1 -1
- data/lib/consolr.rb +37 -43
- metadata +40 -59
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9e0c169d293da7fe9f2a8abce0ccd0dbdfc3db67
|
4
|
+
data.tar.gz: 5c12285ad2711d4c6fb006c1f20e09178d828095
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9df38b3ca9fcb823abe08870b3f2d5d41410feb979bac3fffd21fa6e7b99bf91f3d8ac1b52d794cecbbbde120e6b10bf61624be2972550791921c4deabea6b66
|
7
|
+
data.tar.gz: d33f272bf6a0667b95a072f791255607cf8ecb9d8aa1219c535cfc1b4cbeda84e294ede08fabee6b25e8f32d27ce44a3699ae31752757041fca4da0f2112fea9
|
data/lib/consolr/version.rb
CHANGED
data/lib/consolr.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
$LOAD_PATH.unshift('./lib/')
|
2
|
+
|
1
3
|
require 'collins_auth'
|
2
4
|
require 'optparse'
|
3
5
|
require 'yaml'
|
6
|
+
require 'consolr/version'
|
4
7
|
|
5
8
|
module Consolr
|
6
9
|
class Console
|
@@ -11,12 +14,12 @@ module Consolr
|
|
11
14
|
config_file = [ENV['CONSOLR_CONFIG'],
|
12
15
|
'~/.consolr.yml', '~/.consolr.yaml',
|
13
16
|
'/etc/consolr.yml', '/etc/consolr.yaml',
|
14
|
-
'/var/db/consolr.yml', '/var/db/consolr.yaml'].compact.find do |
|
15
|
-
File.readable?
|
17
|
+
'/var/db/consolr.yml', '/var/db/consolr.yaml'].compact.find do |conf|
|
18
|
+
File.readable?(File.expand_path(conf, __FILE__)) and File.size(File.expand_path(conf, __FILE__)) > 0
|
16
19
|
end
|
17
20
|
|
18
21
|
config_params = begin
|
19
|
-
YAML.load(File.open(config_file))
|
22
|
+
YAML.load(File.open(File.expand_path(config_file, __FILE__)))
|
20
23
|
rescue TypeError => e
|
21
24
|
puts "-------"
|
22
25
|
puts "Failed to load Configuration File ... "
|
@@ -72,24 +75,24 @@ module Consolr
|
|
72
75
|
|
73
76
|
@options = {}
|
74
77
|
@opt_parser = OptionParser.new do |opt|
|
75
|
-
opt.banner =
|
76
|
-
opt.separator
|
77
|
-
opt.separator
|
78
|
-
|
79
|
-
opt.on("-c","--console","console into node via SOL") { options[:console] = true }
|
80
|
-
opt.on("-d","--dangerous","list dangerous stuff") { options[:dangerous] = true }
|
81
|
-
opt.on("-f","--force","force run dangerous actions") { options[:force] = true }
|
82
|
-
opt.on("-h","--help","help") { exit 0 }
|
83
|
-
opt.on("-H","--hostname ASSET","asset hostname") { |hostname| options[:hostname] = hostname }
|
84
|
-
opt.on("-i","--identify","turn on chassis UID") { options[:identify] = true }
|
85
|
-
opt.on("-k","--kick","kick if someone is hogging the console") { options[:kick] = true }
|
86
|
-
opt.on("-l","--log LOG","System Event Log (SEL) [list|clear]") { |log| options[:log] = log }
|
87
|
-
opt.on("-o","--on","turn on node") { options[:on] = true }
|
88
|
-
opt.on("-r","--reboot","restart node") { options[:reboot] = true }
|
89
|
-
opt.on("-s","--sdr","Sensor Data Repository (SDR)") { options[:sdr] = true }
|
90
|
-
opt.on("-t","--tag ASSET","asset tag") { |tag| options[:tag] = tag }
|
91
|
-
opt.on("-x","--off","turn off node") { options[:off] = true }
|
78
|
+
opt.banner = 'Usage: consolr [OPTIONS]'
|
79
|
+
opt.separator ''
|
80
|
+
opt.separator 'Options'
|
92
81
|
|
82
|
+
opt.on('-c', '--console', 'console into node via SOL') { options[:console] = true }
|
83
|
+
opt.on('-d', '--dangerous', 'list dangerous stuff') { options[:dangerous] = true }
|
84
|
+
opt.on('-f', '--force', 'force run dangerous actions') { options[:force] = true }
|
85
|
+
opt.on('-H', '--hostname ASSET', 'asset hostname') { |hostname| options[:hostname] = hostname }
|
86
|
+
opt.on('-i', '--identify', 'turn on chassis UID') { options[:identify] = true }
|
87
|
+
opt.on('-k', '--kick', 'kick if someone is hogging the console') { options[:kick] = true }
|
88
|
+
opt.on('-l', '--log LOG', 'System Event Log (SEL) [list|clear]') { |log| options[:log] = log }
|
89
|
+
opt.on('-o', '--on', 'turn on node') { options[:on] = true }
|
90
|
+
opt.on('-r', '--reboot', 'restart node') { options[:reboot] = true }
|
91
|
+
opt.on('-s', '--sdr', 'Sensor Data Repository (SDR)') { options[:sdr] = true }
|
92
|
+
opt.on('-t', '--tag ASSET', 'asset tag') { |tag| options[:tag] = tag }
|
93
|
+
opt.on('-x', '--off', 'turn off node') { options[:off] = true }
|
94
|
+
opt.on_tail('-h', '--help', 'help') { puts opt; exit 0 }
|
95
|
+
opt.on_tail('-v', '--version', 'version') { puts Consolr::VERSION; exit 0 }
|
93
96
|
end
|
94
97
|
end
|
95
98
|
|
@@ -100,7 +103,7 @@ module Consolr
|
|
100
103
|
|
101
104
|
def start
|
102
105
|
@opt_parser.parse! # extract from ARGV[]
|
103
|
-
abort("Please pass either the asset tag or hostname" if options[:tag].nil? and options[:hostname].nil?
|
106
|
+
abort("Please pass either the asset tag or hostname") if options[:tag].nil? and options[:hostname].nil?
|
104
107
|
|
105
108
|
abort("Cannot find #{@ipmitool_exec}") unless File.exist?(@ipmitool_exec)
|
106
109
|
|
@@ -142,36 +145,27 @@ module Consolr
|
|
142
145
|
puts "Cannot run dangerous commands on #{@node.hostname} (#{@node.tag} - #{@node.status})"
|
143
146
|
abort dangerous_body
|
144
147
|
end
|
145
|
-
|
148
|
+
|
146
149
|
case
|
147
150
|
when options[:console]
|
148
|
-
puts
|
149
|
-
puts
|
150
|
-
|
151
|
+
puts '--> Opening SOL session (type ~~. to quit)'
|
152
|
+
puts ipmitool_cmd('sol activate')
|
151
153
|
when options[:kick]
|
152
|
-
puts
|
153
|
-
|
154
|
+
puts ipmitool_cmd('sol deactivate')
|
154
155
|
when options[:identify]
|
155
|
-
puts
|
156
|
-
|
156
|
+
puts ipmitool_cmd('chassis identify')
|
157
157
|
when options[:sdr]
|
158
|
-
puts
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
when options[:log] == "clear"
|
164
|
-
puts self.ipmitool_cmd("sel clear")
|
165
|
-
|
158
|
+
puts ipmitool_cmd('sdr elist all')
|
159
|
+
when options[:log] == 'list'
|
160
|
+
puts ipmitool_cmd('sel list')
|
161
|
+
when options[:log] == 'clear'
|
162
|
+
puts ipmitool_cmd('sel clear')
|
166
163
|
when options[:on]
|
167
|
-
puts
|
168
|
-
|
164
|
+
puts ipmitool_cmd('power on')
|
169
165
|
when options[:off]
|
170
|
-
puts
|
171
|
-
|
166
|
+
puts ipmitool_cmd('power off')
|
172
167
|
when options[:reboot]
|
173
|
-
puts
|
174
|
-
|
168
|
+
puts ipmitool_cmd('power cycle')
|
175
169
|
else
|
176
170
|
begin
|
177
171
|
raise OptionParser::MissingArgument, "specify an action"
|
metadata
CHANGED
@@ -1,52 +1,43 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: consolr
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease: false
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 0
|
10
|
-
version: 1.0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Will Richard
|
14
8
|
- Sashidhar Guntury
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
dependencies:
|
22
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2015-07-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
23
15
|
name: collins_auth
|
24
|
-
|
25
|
-
|
26
|
-
none: false
|
27
|
-
requirements:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
28
18
|
- - ~>
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 31
|
31
|
-
segments:
|
32
|
-
- 0
|
33
|
-
- 1
|
34
|
-
- 2
|
19
|
+
- !ruby/object:Gem::Version
|
35
20
|
version: 0.1.2
|
36
21
|
type: :runtime
|
37
|
-
|
38
|
-
|
39
|
-
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.1.2
|
28
|
+
description: Consolr is a utility which speaks to Collins on our behalf and retrieves
|
29
|
+
the address, username and password to connect to that node over IPMI. Passing different
|
30
|
+
flags, we can performs a variety of taks on the node over IPMI. There are safeguards
|
31
|
+
in place to prevent potentially catastrophic actions being performed on nodes.
|
32
|
+
email:
|
40
33
|
- will@tumblr.com
|
41
34
|
- sashi@tumblr.com
|
42
35
|
- collins-sm@googlegroups.com
|
43
|
-
executables:
|
36
|
+
executables:
|
44
37
|
- consolr
|
45
38
|
extensions: []
|
46
|
-
|
47
39
|
extra_rdoc_files: []
|
48
|
-
|
49
|
-
files:
|
40
|
+
files:
|
50
41
|
- Gemfile
|
51
42
|
- LICENSE
|
52
43
|
- README.md
|
@@ -54,39 +45,29 @@ files:
|
|
54
45
|
- consolr.gemspec
|
55
46
|
- lib/consolr.rb
|
56
47
|
- lib/consolr/version.rb
|
57
|
-
has_rdoc: true
|
58
48
|
homepage: https://github.com/tumblr/collins/tree/master/support/ruby/consolr
|
59
|
-
licenses:
|
49
|
+
licenses:
|
60
50
|
- Apache 2.0
|
51
|
+
metadata: {}
|
61
52
|
post_install_message:
|
62
53
|
rdoc_options: []
|
63
|
-
|
64
|
-
require_paths:
|
54
|
+
require_paths:
|
65
55
|
- lib
|
66
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
none: false
|
77
|
-
requirements:
|
78
|
-
- - ">="
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
hash: 3
|
81
|
-
segments:
|
82
|
-
- 0
|
83
|
-
version: "0"
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
84
66
|
requirements: []
|
85
|
-
|
86
67
|
rubyforge_project:
|
87
|
-
rubygems_version:
|
68
|
+
rubygems_version: 2.0.14
|
88
69
|
signing_key:
|
89
|
-
specification_version:
|
90
|
-
summary: consolr is a pure ruby wrapper over IPMI to allow Out of Band communiation
|
70
|
+
specification_version: 4
|
71
|
+
summary: consolr is a pure ruby wrapper over IPMI to allow Out of Band communiation
|
72
|
+
with nodes.
|
91
73
|
test_files: []
|
92
|
-
|