netid-tools 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/README.md +9 -0
- data/Rakefile +3 -0
- data/VERSION +1 -1
- data/bin/ua_check +11 -3
- data/lib/generic-response.rb +3 -0
- data/lib/netid-tools.rb +66 -34
- data/lib/quota-response.rb +6 -0
- data/lib/unix-processes.rb +8 -0
- data/netid-tools.gemspec +11 -3
- data/spec/netid_tools_spec.rb +211 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/unix_processes_spec.rb +0 -0
- metadata +24 -3
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -143,6 +143,15 @@ The NetID you want to check
|
|
143
143
|
Version History
|
144
144
|
===============
|
145
145
|
|
146
|
+
## 0.6.0
|
147
|
+
|
148
|
+
* Add tests; refactor various methods
|
149
|
+
* Switch more commands to use Response objects rather than bare responses. Documentation pending.
|
150
|
+
|
151
|
+
## 0.5.5
|
152
|
+
|
153
|
+
* Switch process listing to individual class
|
154
|
+
|
146
155
|
## 0.5.4
|
147
156
|
|
148
157
|
* Switch table formatting on ua_check binary
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/bin/ua_check
CHANGED
@@ -69,11 +69,19 @@ user.each do |netid|
|
|
69
69
|
hosts.each do |host|
|
70
70
|
processes = checkr.get_processes(host)
|
71
71
|
if processes
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
table = Terminal::Table.new do |t|
|
73
|
+
t.title = host
|
74
|
+
t.headings = processes.headers
|
75
|
+
processes.processes.each do |p|
|
76
|
+
if p[9].length > 80
|
77
|
+
p[9].slice!(80,p[9].length-80)
|
78
|
+
end
|
79
|
+
t << p
|
80
|
+
end
|
75
81
|
end
|
82
|
+
|
76
83
|
end
|
84
|
+
puts table
|
77
85
|
end
|
78
86
|
end
|
79
87
|
|
data/lib/generic-response.rb
CHANGED
data/lib/netid-tools.rb
CHANGED
@@ -3,13 +3,15 @@ require 'colored'
|
|
3
3
|
require 'netid-validator'
|
4
4
|
require 'system-connect'
|
5
5
|
require 'generic-response'
|
6
|
+
require 'unix-processes'
|
7
|
+
require 'quota-response'
|
6
8
|
|
7
9
|
class Netid
|
8
10
|
include SystemConnect
|
9
11
|
|
10
|
-
attr_accessor :netid, :system_user, :systems, :
|
12
|
+
attr_accessor :netid, :system_user, :systems, :primary_host, :secondary_host
|
11
13
|
|
12
|
-
def initialize(netid,system_user=nil,systems=nil,
|
14
|
+
def initialize(netid,system_user=nil,systems=nil,primary_host=nil,secondary_host=nil)
|
13
15
|
@netid = netid
|
14
16
|
@system_user = system_user || `whoami`.chomp
|
15
17
|
@systems = systems || ["ovid01.u.washington.edu",
|
@@ -17,7 +19,8 @@ class Netid
|
|
17
19
|
"ovid03.u.washington.edu",
|
18
20
|
"vergil.u.washington.edu"
|
19
21
|
]
|
20
|
-
@
|
22
|
+
@primary_host = primary_host || "ovid02.u.washington.edu"
|
23
|
+
@secondary_host = secondary_host || "vergil.u.washington.edu"
|
21
24
|
end
|
22
25
|
|
23
26
|
def validate_netid
|
@@ -37,7 +40,7 @@ class Netid
|
|
37
40
|
result = run_remote_command(command,host)
|
38
41
|
if result =~ /mysql/
|
39
42
|
/port=(?<port>\d+)/ =~ result
|
40
|
-
[host,port]
|
43
|
+
[host,port.to_i]
|
41
44
|
else
|
42
45
|
false
|
43
46
|
end
|
@@ -45,20 +48,44 @@ class Netid
|
|
45
48
|
|
46
49
|
def get_processes(host)
|
47
50
|
if /no such user/i =~ run_remote_command("id #{netid}",host)
|
48
|
-
result =
|
51
|
+
result = false
|
49
52
|
else
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
|
54
|
+
command = "ps -o pid,user,cputime,nice,wchan,pcpu,pmem,rss,start_time,cmd --user #{netid}"
|
55
|
+
raw_processes = run_remote_command(command,host).lines.map{|l| l.chomp}
|
56
|
+
refined_processes = UnixProcesses.new(host)
|
57
|
+
|
58
|
+
refined_processes.headers = raw_processes[0].split
|
59
|
+
raw_processes.delete_at(0)
|
60
|
+
|
61
|
+
refined_processes.processes = raw_processes.map do |line|
|
62
|
+
line = line.split
|
63
|
+
|
64
|
+
if line.size > 9
|
65
|
+
process = line.slice!(9,line.size-9)
|
66
|
+
line[9] = process.join(" ")
|
67
|
+
end
|
68
|
+
line
|
69
|
+
end
|
70
|
+
refined_processes
|
57
71
|
end
|
72
|
+
|
73
|
+
|
74
|
+
# if /no such user/i =~ run_remote_command("id #{netid}",host)
|
75
|
+
# result = nil
|
76
|
+
# else
|
77
|
+
# result = run_remote_command("ps -F --user=#{netid}",host).lines.map{|l| l.chomp}
|
78
|
+
# result = remove_extra_processes(result)
|
79
|
+
# end
|
80
|
+
# if result.nil? || result.count == 1
|
81
|
+
# false
|
82
|
+
# else
|
83
|
+
# result
|
84
|
+
# end
|
58
85
|
end
|
59
86
|
|
60
87
|
def check_for_localhome
|
61
|
-
result = run_remote_command("cpw -poh #{netid}",
|
88
|
+
result = run_remote_command("cpw -poh #{netid}",primary_host)
|
62
89
|
if result =~ /Unknown/
|
63
90
|
false
|
64
91
|
else
|
@@ -69,9 +96,9 @@ class Netid
|
|
69
96
|
def check_webtype
|
70
97
|
result = []
|
71
98
|
command = "webtype -user #{netid}"
|
72
|
-
result = run_remote_command(command,
|
99
|
+
result = run_remote_command(command,primary_host).chomp.split
|
73
100
|
if result[0] == "user"
|
74
|
-
result = run_remote_command(command,
|
101
|
+
result = run_remote_command(command,secondary_host).chomp.split
|
75
102
|
else
|
76
103
|
result
|
77
104
|
end
|
@@ -79,25 +106,29 @@ class Netid
|
|
79
106
|
|
80
107
|
|
81
108
|
def check_quota
|
82
|
-
result = run_remote_command("quota #{netid}",single_host)
|
83
|
-
result = result.chomp.split("\n")
|
84
|
-
result.delete_at(0) if result.first == ''
|
85
|
-
uid = /uid\s(\d+)/.match(result.first)[1].to_i
|
86
|
-
result.delete_at(0)
|
87
|
-
|
88
|
-
headings = process_quota_headers(result)
|
89
109
|
|
90
|
-
|
91
|
-
results << headings
|
92
|
-
result.each do |line|
|
93
|
-
line = line.split
|
94
|
-
line.insert(4, 'n/a') if line.size == 6
|
110
|
+
command_result = run_remote_command("quota #{netid}",primary_host)
|
95
111
|
|
96
|
-
|
97
|
-
|
98
|
-
|
112
|
+
if command_result =~ /unknown user/
|
113
|
+
result = GenericResponse.new
|
114
|
+
result.error = "Unknown User #{netid} on #{primary_host}"
|
115
|
+
result.response = false
|
116
|
+
else
|
117
|
+
result = QuotaResponse.new
|
118
|
+
|
119
|
+
command_result = command_result.chomp.split("\n")
|
120
|
+
command_result.delete_at(0) if command_result.first == ""
|
121
|
+
command_result.delete_at(0) # remove uid line
|
122
|
+
|
123
|
+
result.headers = process_quota_headers(command_result)
|
124
|
+
result.response = command_result.map do |line|
|
125
|
+
line = line.split
|
126
|
+
line.insert(4, 'n/a') if line.size == 6
|
127
|
+
expand_cluster_path(line)
|
128
|
+
line
|
129
|
+
end
|
99
130
|
end
|
100
|
-
|
131
|
+
result
|
101
132
|
end
|
102
133
|
|
103
134
|
private
|
@@ -128,13 +159,14 @@ class Netid
|
|
128
159
|
end
|
129
160
|
|
130
161
|
def get_user_clusters
|
131
|
-
if user_clusters
|
132
|
-
user_clusters
|
162
|
+
if @user_clusters
|
163
|
+
@user_clusters
|
133
164
|
else
|
134
165
|
command = "gpw -D #{netid} | sed '1d' | sed 'N;$!P;$!D;$d' | sort | uniq"
|
135
|
-
run_remote_command(command,
|
166
|
+
@user_clusters = run_remote_command(command,primary_host).map do |line|
|
136
167
|
line.chomp
|
137
168
|
end
|
138
169
|
end
|
139
170
|
end
|
171
|
+
|
140
172
|
end
|
data/netid-tools.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "netid-tools"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Nikky Southerland"]
|
12
|
-
s.date = "2013-06-
|
12
|
+
s.date = "2013-06-27"
|
13
13
|
s.description = "Gem with various methods to support UW NetIDs"
|
14
14
|
s.email = "nikky@uw.edu"
|
15
15
|
s.executables = ["ua_check"]
|
@@ -28,8 +28,13 @@ Gem::Specification.new do |s|
|
|
28
28
|
"lib/generic-response.rb",
|
29
29
|
"lib/netid-tools.rb",
|
30
30
|
"lib/netid-validator.rb",
|
31
|
+
"lib/quota-response.rb",
|
31
32
|
"lib/system-connect.rb",
|
32
|
-
"
|
33
|
+
"lib/unix-processes.rb",
|
34
|
+
"netid-tools.gemspec",
|
35
|
+
"spec/netid_tools_spec.rb",
|
36
|
+
"spec/spec_helper.rb",
|
37
|
+
"spec/unix_processes_spec.rb"
|
33
38
|
]
|
34
39
|
s.homepage = "http://github.com/allynfolksjr/netid-tools"
|
35
40
|
s.licenses = ["Apache License, Version 2.0"]
|
@@ -45,6 +50,7 @@ Gem::Specification.new do |s|
|
|
45
50
|
s.add_runtime_dependency(%q<colored>, [">= 0"])
|
46
51
|
s.add_runtime_dependency(%q<net-ssh>, [">= 0"])
|
47
52
|
s.add_runtime_dependency(%q<terminal-table>, [">= 0"])
|
53
|
+
s.add_runtime_dependency(%q<rspec>, [">= 0"])
|
48
54
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
49
55
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
50
56
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
@@ -57,6 +63,7 @@ Gem::Specification.new do |s|
|
|
57
63
|
s.add_dependency(%q<colored>, [">= 0"])
|
58
64
|
s.add_dependency(%q<net-ssh>, [">= 0"])
|
59
65
|
s.add_dependency(%q<terminal-table>, [">= 0"])
|
66
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
60
67
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
61
68
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
62
69
|
s.add_dependency(%q<bundler>, [">= 0"])
|
@@ -70,6 +77,7 @@ Gem::Specification.new do |s|
|
|
70
77
|
s.add_dependency(%q<colored>, [">= 0"])
|
71
78
|
s.add_dependency(%q<net-ssh>, [">= 0"])
|
72
79
|
s.add_dependency(%q<terminal-table>, [">= 0"])
|
80
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
73
81
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
74
82
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
75
83
|
s.add_dependency(%q<bundler>, [">= 0"])
|
@@ -0,0 +1,211 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'netid-tools'
|
3
|
+
|
4
|
+
describe Netid do
|
5
|
+
|
6
|
+
def mock_system_response(*responses)
|
7
|
+
responses.each do |response|
|
8
|
+
@netid.should_receive(:run_remote_command).and_return(response)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
before do
|
13
|
+
@netid = Netid.new('test')
|
14
|
+
end
|
15
|
+
|
16
|
+
context "sanity checks" do
|
17
|
+
it "responds to #netid" do
|
18
|
+
@netid.should respond_to :netid
|
19
|
+
@netid.netid.should eq 'test'
|
20
|
+
end
|
21
|
+
it "responds to #system_user" do
|
22
|
+
@netid.should respond_to :system_user
|
23
|
+
@netid.system_user.should eq `whoami`.chomp
|
24
|
+
end
|
25
|
+
it "responds to #systems" do
|
26
|
+
@netid.should respond_to :systems
|
27
|
+
@netid.systems.should respond_to :size
|
28
|
+
end
|
29
|
+
it "responds to #primary_host" do
|
30
|
+
@netid.should respond_to :primary_host
|
31
|
+
@netid.primary_host.should_not be_nil
|
32
|
+
end
|
33
|
+
it "responds to #secondary_host" do
|
34
|
+
@netid.should respond_to :secondary_host
|
35
|
+
@netid.secondary_host.should_not be_nil
|
36
|
+
end
|
37
|
+
it "requires a NetID to be initialized" do
|
38
|
+
expect do
|
39
|
+
Netid.new
|
40
|
+
end.to raise_error
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
context "#validate_netid" do
|
46
|
+
it "returns a GenericResponse of true on valid NetID" do
|
47
|
+
@netid.validate_netid.response.should eq true
|
48
|
+
end
|
49
|
+
it "returns a GenericResponse of false on invalid netid" do
|
50
|
+
Netid.new('123test').validate_netid.response.should be_false
|
51
|
+
end
|
52
|
+
it "returns a GenericResponse with error message on invalid netid" do
|
53
|
+
Netid.new('123test').validate_netid.error.should eq "Not a valid NetID"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "#validate_netid?" do
|
58
|
+
it "returns true on valid NetID" do
|
59
|
+
@netid.validate_netid?.should be_true
|
60
|
+
end
|
61
|
+
it "returns false on NetID that starts with number" do
|
62
|
+
Netid.new('123test').validate_netid?.should be_false
|
63
|
+
end
|
64
|
+
it "returns false on NetID that is too long" do
|
65
|
+
Netid.new('abcdefghijklmnop').validate_netid?.should be_false
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context "::validate_netid?" do
|
70
|
+
it "returns true on valid NetID" do
|
71
|
+
Netid.validate_netid?('nikky').should be_true
|
72
|
+
end
|
73
|
+
it "returns false on invalid NetID" do
|
74
|
+
Netid.validate_netid?('123test').should be_false
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context "#check_for_mysql_presence" do
|
79
|
+
it "returns array with host and port on valid return" do
|
80
|
+
valid_return = "nikky 10167 0.0 0.0 271528 2904 ? SNl 2012
|
81
|
+
0:02 /da23/d38/nikky/mysql/bin/mysqld --basedir=/da23/d38/nikky/mysql
|
82
|
+
--datadir=/da23/d38/nikky/mysql/data
|
83
|
+
--plugin-dir=/da23/d38/nikky/mysql/lib/plugin
|
84
|
+
--log-error=/da23/d38/nikky/mysql/data/mysql-bin.err
|
85
|
+
--pid-file=/da23/d38/nikky/mysql/data/ovid02.u.washington.edu.pid
|
86
|
+
--socket=/da23/d38/nikky/mysql.sock --port=5280"
|
87
|
+
mock_system_response(valid_return)
|
88
|
+
@netid.check_for_mysql_presence('fake.example.com').should eq ['fake.example.com', 5280]
|
89
|
+
end
|
90
|
+
it "returns false with no valid result" do
|
91
|
+
mock_system_response("")
|
92
|
+
@netid.check_for_mysql_presence('fake.example.com').should be_false
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context "#get_processes" do
|
97
|
+
it "returns false if a user is not detected" do
|
98
|
+
mock_system_response("no such user")
|
99
|
+
@netid.get_processes('example.com').should be_false
|
100
|
+
end
|
101
|
+
it "returns a UnixProcesses object on success" do
|
102
|
+
mock_system_response("exists","1\n2\n3")
|
103
|
+
@netid.get_processes('example.com').class.should eq UnixProcesses
|
104
|
+
end
|
105
|
+
it "contains proper headers with successful return" do
|
106
|
+
mock_system_response("exists","a b c\n2\n3")
|
107
|
+
@netid.get_processes('example.com').headers.should eq %w(a b c)
|
108
|
+
end
|
109
|
+
it "properly merges commnds with spaces into one array element" do
|
110
|
+
mock_system_response("exists","a b c\n1 2 3 4 5 6 7 8 9 command with space\n2")
|
111
|
+
@netid.get_processes('example.com').processes.first[9].should eq "command with space"
|
112
|
+
end
|
113
|
+
it "properly handles commnds without spaces" do
|
114
|
+
mock_system_response("exists","a b c\n1 2 3 4 5 6 7 8 9 command_without_space\n2")
|
115
|
+
@netid.get_processes('example.com').processes.first[9].should eq "command_without_space"
|
116
|
+
end
|
117
|
+
it "doesn't contain newlines" do
|
118
|
+
mock_system_response("exists","1\n2\n3")
|
119
|
+
@netid.get_processes('example.com').processes.select{|s| s =~ /\/n/}.should be_empty
|
120
|
+
end
|
121
|
+
it "doesn't contain headers in main processes object" do
|
122
|
+
mock_system_response("exists","headers pid guid\n1 2 3 4 5 6 7 8 9 command with space\n2")
|
123
|
+
return_obj = @netid.get_processes('example.com')
|
124
|
+
return_obj.headers.should eq %w(headers pid guid)
|
125
|
+
return_obj.processes.should_not include %w(headers pid guid)
|
126
|
+
end
|
127
|
+
it "has processes which responds to .each" do
|
128
|
+
mock_system_response("exists","headers pid guid\n1 2 3 4 5 6 7 8 9 command with space\n2")
|
129
|
+
return_obj = @netid.get_processes('example.com')
|
130
|
+
return_obj.processes.should respond_to(:each)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
context "#check_for_localhome" do
|
135
|
+
it "returns the localhome location upon success" do
|
136
|
+
mock_system_response("/ov03/dw21/derp")
|
137
|
+
@netid.check_for_localhome.should eq ("/ov03/dw21/derp")
|
138
|
+
end
|
139
|
+
it "returns false if no result" do
|
140
|
+
mock_system_response("user Unknown")
|
141
|
+
@netid.check_for_localhome.should be_false
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
context "#check_webtype" do
|
146
|
+
it "returns array of webtypes upon success" do
|
147
|
+
mock_system_response("depts\ncourses")
|
148
|
+
@netid.check_webtype.should eq %w(depts courses)
|
149
|
+
end
|
150
|
+
it "returns empty array if no webtypes found" do
|
151
|
+
mock_system_response("")
|
152
|
+
@netid.check_webtype.should be_empty
|
153
|
+
end
|
154
|
+
it "tries alternate host if primary returns no user found" do
|
155
|
+
mock_system_response("user Unknown","depts\ncourses")
|
156
|
+
@netid.check_webtype.should eq %w(depts courses)
|
157
|
+
end
|
158
|
+
it "returns empty array if no webtypes found on alternate host" do
|
159
|
+
mock_system_response("user Unknown","")
|
160
|
+
@netid.check_webtype.should eq %w()
|
161
|
+
end
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
context "#check_quota" do
|
166
|
+
default_quota_return_objects = []
|
167
|
+
it "returns an object of results on success" do
|
168
|
+
mock_system_response("\nuser uid 1 2 3\nheader a b c\nfilesystem usage quota limit files limit",default_quota_return_objects)
|
169
|
+
@netid.check_quota.should be_true
|
170
|
+
end
|
171
|
+
it "returns false upon failure" do
|
172
|
+
mock_system_response("unknown user")
|
173
|
+
@netid.check_quota.response.should be_false
|
174
|
+
end
|
175
|
+
it "return object has and responds to #response" do
|
176
|
+
mock_system_response("\nuser uid 1 2 3\nheader a b c\nfilesystem usage quota limit files limit",default_quota_return_objects)
|
177
|
+
@netid.check_quota.response.should eq [%w(filesystem usage quota limit n/a files limit)]
|
178
|
+
end
|
179
|
+
it "returns object with headers" do
|
180
|
+
mock_system_response("\nuser uid 1 2 3\nheader a b c\nfilesystem usage quota limit files limit",default_quota_return_objects)
|
181
|
+
@netid.check_quota.headers.should eq %w(header a b c)
|
182
|
+
end
|
183
|
+
it "will insert 'n/a' into 5th element if blank" do
|
184
|
+
mock_system_response("\nuser uid 1 2 3\nheader a b c\nfilesystem usage quota limit files limit\nfilesystem usage quota limit files limit",default_quota_return_objects)
|
185
|
+
@netid.check_quota.response.should eq [%w(filesystem usage quota limit n/a files limit), %w(filesystem usage quota limit n/a files limit)]
|
186
|
+
end
|
187
|
+
it "will not insert 'n/a' into 5th element if length is 7" do
|
188
|
+
mock_system_response("\nuser uid 1 2 3\nheader a b c\nfilesystem usage quota limit grace files limit\nfilesystem usage quota limit grace files limit",default_quota_return_objects)
|
189
|
+
@netid.check_quota.response.should eq [%w(filesystem usage quota limit grace files limit), %w(filesystem usage quota limit grace files limit)]
|
190
|
+
end
|
191
|
+
it "will handle mixed 5th element situations" do
|
192
|
+
mock_system_response("\nuser uid 1 2 3\nheader a b c\nfilesystem usage quota limit files limit\nfilesystem usage quota limit grace files limit",default_quota_return_objects)
|
193
|
+
@netid.check_quota.response.should eq [%w(filesystem usage quota limit n/a files limit), %w(filesystem usage quota limit grace files limit)]
|
194
|
+
end
|
195
|
+
it "will translate cluster shortnames into full path, if available" do
|
196
|
+
mock_system_response("\nuser uid 1 2 3\nheader a b c\n/cg32 usage quota limit files limit\n/hw00 usage quota limit grace files limit",
|
197
|
+
["/cg32/rw00/derp", "/hw00/w00/ferp"])
|
198
|
+
@netid.check_quota.response.should eq [%w(/cg32/rw00/derp usage quota limit n/a files limit), %w(/hw00/w00/ferp usage quota limit grace files limit)]
|
199
|
+
end
|
200
|
+
it "will fall back to cluster shortnames if full path not found" do
|
201
|
+
mock_system_response("\nuser uid 1 2 3\nheader a b c\n/cg32 usage quota limit files limit\n/hw00 usage quota limit grace files limit",
|
202
|
+
["/cg31/rw00/derp", "/hw01/w00/ferp"])
|
203
|
+
@netid.check_quota.response.should eq [%w(/cg32 usage quota limit n/a files limit), %w(/hw00 usage quota limit grace files limit)]
|
204
|
+
end
|
205
|
+
it "will handle mixed matching and unmatching clusters" do
|
206
|
+
mock_system_response("\nuser uid 1 2 3\nheader a b c\n/cg32 usage quota limit files limit\n/hw00 usage quota limit grace files limit",
|
207
|
+
["/cg31/rw00/derp", "/hw00/w00/ferp"])
|
208
|
+
@netid.check_quota.response.should eq [%w(/cg32 usage quota limit n/a files limit), %w(/hw00/w00/ferp usage quota limit grace files limit)]
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
data/spec/spec_helper.rb
ADDED
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netid-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
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-06-
|
12
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -75,6 +75,22 @@ dependencies:
|
|
75
75
|
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
78
94
|
- !ruby/object:Gem::Dependency
|
79
95
|
name: shoulda
|
80
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,8 +222,13 @@ files:
|
|
206
222
|
- lib/generic-response.rb
|
207
223
|
- lib/netid-tools.rb
|
208
224
|
- lib/netid-validator.rb
|
225
|
+
- lib/quota-response.rb
|
209
226
|
- lib/system-connect.rb
|
227
|
+
- lib/unix-processes.rb
|
210
228
|
- netid-tools.gemspec
|
229
|
+
- spec/netid_tools_spec.rb
|
230
|
+
- spec/spec_helper.rb
|
231
|
+
- spec/unix_processes_spec.rb
|
211
232
|
homepage: http://github.com/allynfolksjr/netid-tools
|
212
233
|
licenses:
|
213
234
|
- Apache License, Version 2.0
|
@@ -223,7 +244,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
223
244
|
version: '0'
|
224
245
|
segments:
|
225
246
|
- 0
|
226
|
-
hash:
|
247
|
+
hash: -3395110718720004722
|
227
248
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
249
|
none: false
|
229
250
|
requirements:
|