netid-tools 0.3.5 → 0.3.6

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.
Files changed (5) hide show
  1. data/README.md +7 -0
  2. data/VERSION +1 -1
  3. data/bin/ua_check +46 -26
  4. data/netid-tools.gemspec +2 -2
  5. metadata +3 -3
data/README.md CHANGED
@@ -130,6 +130,13 @@ The NetID you want to check
130
130
 
131
131
  Version History
132
132
  ===============
133
+ ## 0.3.6
134
+
135
+ * Add concise mode via -c flag to ua_check (skips quota results)
136
+ * Add OptionParser to ua_check
137
+ * Tweak formatting for results
138
+ * Allow multiple lookups per execption
139
+
133
140
  ## 0.3.3
134
141
 
135
142
  * Fix broken code so that it properly displays localhome
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.5
1
+ 0.3.6
data/bin/ua_check CHANGED
@@ -2,6 +2,20 @@
2
2
  require 'net/ssh'
3
3
  require 'colored'
4
4
  require 'netid-tools'
5
+ require 'optparse'
6
+
7
+ options = {}
8
+ OptionParser.new do |opts|
9
+ opts.banner = "Usage: ua_check [options]"
10
+
11
+
12
+ opts.on("-c", "--concise", "Concise Results") do |c|
13
+ options[:concise] = c
14
+ end
15
+ opts.on("-d", "--debug", "Run in debug (verbosely)") do |d|
16
+ options[:debug] = d
17
+ end
18
+ end.parse!
5
19
 
6
20
  # This is a simple script that will go through various hosts and check to see
7
21
  # if a specified user is running MySQLd
@@ -20,43 +34,49 @@ require 'netid-tools'
20
34
 
21
35
  # Set up initial variables
22
36
  $results = 0
23
- raise "No user specified. Bailing." if ARGV[0].nil?
24
- user = ARGV[0].chomp.downcase
25
- raise "This is not a valid NetID!" unless Netid.validate_netid?(user)
37
+ raise "No NetID(s) specified. Bailing." if ARGV.empty?
38
+ user = ARGV.map{|n| n.downcase}
39
+ user.each do |netid|
40
+ raise "#{netid} is not a valid NetID! Exiting." unless Netid.validate_netid?(netid)
41
+ end
26
42
  # get the user of whoever is running script
27
43
  system_user = `whoami`.chomp
28
44
  system_hostname = `hostname`.chomp
29
45
  # Initialize the systems we'll check
30
46
  hosts = [ "ovid01.u.washington.edu",
31
- "ovid02.u.washington.edu",
32
- "ovid03.u.washington.edu",
33
- "ovid21.u.washington.edu",
34
- "vergil.u.washington.edu"
35
- ]
36
-
47
+ "ovid02.u.washington.edu",
48
+ "ovid03.u.washington.edu",
49
+ "ovid21.u.washington.edu",
50
+ "vergil.u.washington.edu"
51
+ ]
37
52
 
53
+ puts "Running UA Check for on behalf of #{system_user}\n".green
38
54
 
39
- puts "Running UA Check for NetID #{user} on behalf of #{system_user}\n".green
40
-
55
+ user.each do |netid|
56
+ puts "#{netid}".bold.green
57
+ puts "-"*netid.length
58
+ results = 0
59
+ hosts.each do |host|
60
+ result = Netid.check_for_mysql_presence(host,netid,system_user)
61
+ if result
62
+ results += 1
63
+ puts "MySQLd detected on #{result[0]}:#{result[1]}".blue
64
+ end
65
+ end
41
66
 
42
- results = 0
43
- hosts.each do |host|
44
- result = Netid.check_for_mysql_presence(host,user,system_user)
67
+ result = Netid.check_for_localhome(netid,system_user)
45
68
  if result
46
- results += 1
47
- puts "MySQLd detected on #{result[0]}:#{result[1]}".blue
69
+ puts "Localhome: #{result}".cyan
70
+ else
71
+ puts "No localhome detected"
48
72
  end
49
- end
50
73
 
51
- result = Netid.check_for_localhome(user,system_user)
52
- if result
53
- puts "Localhome: #{result}".cyan
54
- else
55
- puts "No localhome detected"
56
- end
57
-
58
- puts "No MySQLds Detected".bold.blue if results == 0
74
+ puts "No MySQLds Detected".bold.blue if results == 0
59
75
  #uts "Multiple MySQLds Detected!".bold.red if results > 1
60
76
  #puts Netid.check_for_localhome(user,system_user).cyan if results > 0
77
+ unless options[:concise]
78
+ puts "\n"
79
+ Netid.quota_check(netid,system_user)
80
+ end
61
81
  puts "\n"
62
- Netid.quota_check(user,system_user)
82
+ 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.3.5"
8
+ s.version = "0.3.6"
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-01-16"
12
+ s.date = "2013-01-25"
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.3.5
4
+ version: 0.3.6
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-01-16 00:00:00.000000000 Z
12
+ date: 2013-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -206,7 +206,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
206
  version: '0'
207
207
  segments:
208
208
  - 0
209
- hash: 1514504794858780107
209
+ hash: -1217487878103725652
210
210
  required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  none: false
212
212
  requirements: