netid-tools 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -0
- data/VERSION +1 -1
- data/lib/netid-tools.rb +39 -3
- data/netid-tools.gemspec +2 -2
- metadata +3 -3
data/README.md
CHANGED
@@ -143,6 +143,10 @@ The NetID you want to check
|
|
143
143
|
Version History
|
144
144
|
===============
|
145
145
|
|
146
|
+
## 0.5.2
|
147
|
+
|
148
|
+
* Expand cluster paths if available in quota output
|
149
|
+
|
146
150
|
## 0.5.0
|
147
151
|
|
148
152
|
* Switch to new SSH connection method; reuse already existing SSH connection for host if it exists
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
data/lib/netid-tools.rb
CHANGED
@@ -7,7 +7,7 @@ require 'generic-response'
|
|
7
7
|
class Netid
|
8
8
|
include SystemConnect
|
9
9
|
|
10
|
-
attr_accessor :netid, :system_user, :systems, :single_host
|
10
|
+
attr_accessor :netid, :system_user, :systems, :single_host, :user_clusters
|
11
11
|
|
12
12
|
def initialize(netid,system_user=nil,systems=nil,single_host=nil)
|
13
13
|
@netid = netid
|
@@ -84,13 +84,17 @@ class Netid
|
|
84
84
|
result.delete_at(0) if result.first == ''
|
85
85
|
uid = /uid\s(\d+)/.match(result.first)[1].to_i
|
86
86
|
result.delete_at(0)
|
87
|
-
|
88
|
-
result
|
87
|
+
|
88
|
+
headings = process_quota_headers(result)
|
89
|
+
|
89
90
|
results = []
|
90
91
|
results << headings
|
91
92
|
result.each do |line|
|
92
93
|
line = line.split
|
93
94
|
line.insert(4, 'n/a') if line.size == 6
|
95
|
+
|
96
|
+
expand_cluster_path(line)
|
97
|
+
|
94
98
|
results << line
|
95
99
|
end
|
96
100
|
results
|
@@ -102,4 +106,36 @@ class Netid
|
|
102
106
|
line !~ /ps -F --user|ssh(d:|-agent)|bash|zsh/
|
103
107
|
end
|
104
108
|
end
|
109
|
+
|
110
|
+
def process_quota_headers(quota_results)
|
111
|
+
headings = quota_results.first.split
|
112
|
+
quota_results.delete_at(0)
|
113
|
+
headings
|
114
|
+
end
|
115
|
+
|
116
|
+
def expand_cluster_path(line)
|
117
|
+
clusters = get_user_clusters
|
118
|
+
|
119
|
+
asking_cluster_string = line.first
|
120
|
+
|
121
|
+
search = clusters.find_index do |c|
|
122
|
+
puts "searching for #{asking_cluster_string} in #{c}"
|
123
|
+
c =~ /#{asking_cluster_string}/
|
124
|
+
end
|
125
|
+
|
126
|
+
line[0] = clusters[search] if search
|
127
|
+
|
128
|
+
line
|
129
|
+
end
|
130
|
+
|
131
|
+
def get_user_clusters
|
132
|
+
if user_clusters
|
133
|
+
user_clusters
|
134
|
+
else
|
135
|
+
command = "gpw -D | sed '1d' | sed 'N;$!P;$!D;$d' | sort | uniq"
|
136
|
+
run_remote_command(command,single_host).split("\n").map do |line|
|
137
|
+
line.chomp
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
105
141
|
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.5.
|
8
|
+
s.version = "0.5.2"
|
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-26"
|
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"]
|
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.5.
|
4
|
+
version: 0.5.2
|
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-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -207,7 +207,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
207
|
version: '0'
|
208
208
|
segments:
|
209
209
|
- 0
|
210
|
-
hash:
|
210
|
+
hash: -1308523131387062882
|
211
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
212
|
none: false
|
213
213
|
requirements:
|