psadmin_plus 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/bin/psa +19 -6
- data/lib/psadmin_plus.rb +9 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03e679bf635691b90fb0d7cf75190a02540d332c
|
|
4
|
+
data.tar.gz: 329b50f2219f13063fd45e7f930af74c88e4a9dd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cd9664c5250d3e420f4974bc628822132ad473f1f159185dadb93f12cc1ce86f8fc559a93d532f72f4ac785e72925733dd4f658fbe95c48e5655c75e78e1b8c2
|
|
7
|
+
data.tar.gz: 128d8f65f4fb0ec03f901d4a45b1b39ff745ec619c2e0409d1bc3cbe84e03f82bfb43316e81386a56a39ec4c89b9b6ffb42e1bf739c4d3830966f2a083277b0c
|
data/bin/psa
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
require 'psadmin_plus'
|
|
4
|
+
#require_relative '../lib/psadmin_plus.rb'
|
|
4
5
|
|
|
5
6
|
# options
|
|
6
7
|
opts_c = ARGV.shift || "help"
|
|
@@ -14,14 +15,26 @@ domains = opts_d.split(',')
|
|
|
14
15
|
if types.include? "all" then types = ['app','prcs','web'] end
|
|
15
16
|
if domains.include? "all" then all_domains = true end
|
|
16
17
|
|
|
18
|
+
# setup environment
|
|
19
|
+
PS_PSA_CONF = ENV['PS_PSA_CONF'] || "#{ENV['HOME']}/.psa.conf"
|
|
20
|
+
if File.exists?(PS_PSA_CONF) then
|
|
21
|
+
File.readlines(PS_PSA_CONF).each do |line|
|
|
22
|
+
if line.start_with? "#" then
|
|
23
|
+
next
|
|
24
|
+
else
|
|
25
|
+
key, value = line.split "="
|
|
26
|
+
ENV[key] = value.strip
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
17
31
|
# constants
|
|
18
32
|
OS_CONST = os
|
|
19
|
-
PS_RUNTIME_USER = "psadm2"
|
|
20
|
-
PS_POOL_MGMT = "on"
|
|
21
|
-
PS_HEALTH_FILE = "health.html"
|
|
22
|
-
PS_HEALTH_TIME = "60"
|
|
23
|
-
PS_PSA_SUDO = "on"
|
|
24
|
-
IS_RUNTIME_USER = false # TODO
|
|
33
|
+
PS_RUNTIME_USER = ENV['PS_RUNTIME_USER'] || "psadm2"
|
|
34
|
+
PS_POOL_MGMT = ENV['PS_POOL_MGMT'] || "on"
|
|
35
|
+
PS_HEALTH_FILE = ENV['PS_HEALTH_FILE'] || "health.html"
|
|
36
|
+
PS_HEALTH_TIME = ENV['PS_HEALTH_TIME'] || "60"
|
|
37
|
+
PS_PSA_SUDO = ENV['PS_PSA_SUDO'] || "on"
|
|
25
38
|
|
|
26
39
|
# process
|
|
27
40
|
commands.each do |c|
|
data/lib/psadmin_plus.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
require 'rbconfig'
|
|
4
|
+
require 'etc'
|
|
4
5
|
|
|
5
6
|
def do_help
|
|
6
7
|
puts "Usage: psa [command] <type> <domain>"
|
|
@@ -39,17 +40,21 @@ def do_help
|
|
|
39
40
|
puts " "
|
|
40
41
|
end
|
|
41
42
|
|
|
43
|
+
def do_is_runtime_user
|
|
44
|
+
result = Etc.getlogin == PS_RUNTIME_USER ? true : false
|
|
45
|
+
end
|
|
46
|
+
|
|
42
47
|
def do_cmd(cmd)
|
|
43
48
|
case "#{OS_CONST}"
|
|
44
49
|
when "linux"
|
|
45
|
-
if
|
|
50
|
+
if do_is_runtime_user
|
|
46
51
|
out = `"#{cmd}"`
|
|
47
52
|
else
|
|
48
53
|
if "#{PS_PSA_SUDO}" == "on"
|
|
49
|
-
out = `sudo su -
|
|
54
|
+
out = `sudo su - #{PS_RUNTIME_USER} -c "#{cmd}"`
|
|
50
55
|
else
|
|
51
56
|
print "#{PS_RUNTIME_USER} "
|
|
52
|
-
out = `su -
|
|
57
|
+
out = `su - #{PS_RUNTIME_USER} -c "#{cmd}"`
|
|
53
58
|
end
|
|
54
59
|
end
|
|
55
60
|
when "windows"
|
|
@@ -259,4 +264,4 @@ def os
|
|
|
259
264
|
raise Error::WebDriverError, "unknown os: #{host_os.inspect}"
|
|
260
265
|
end
|
|
261
266
|
)
|
|
262
|
-
end
|
|
267
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: psadmin_plus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kyle Benson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-11-
|
|
11
|
+
date: 2017-11-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A psadmin helper tool
|
|
14
14
|
email: kyle@psadmin.io
|