equitrac_utilities 0.1.0 → 0.1.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e050a9a78e9b6ab78759ccae31433163b684e5143e05ae4466c86cf4129fcff
|
4
|
+
data.tar.gz: c803665fd91de1510dc6bc53f29968f18e4acaf0e17e7be1cf5d0555e0c8e11e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d757129d5456af4dbed26f789d9ec6d3106f142b0a6496ed08bee1e3844129dcce238dbcdf16a671b82b4f2ecb11cbdcd9761265b7d12fc4f5c4ae2571217ea
|
7
|
+
data.tar.gz: c24d3fb9d4fa174a305cc79793858ca4b5258d9a2a5979cd5934c80767cbec442911eb53804b8f6de00dd38e8fb5f2b898aa5b19d44646c248b8dd8f534a4214
|
@@ -36,16 +36,16 @@ module EquitracUtilities
|
|
36
36
|
# @param attributes [Hash] attributes needed to perform command
|
37
37
|
# @return [String] the restult from the ssh command
|
38
38
|
def run(command:, attributes:)
|
39
|
-
|
40
|
-
|
41
|
-
action
|
42
|
-
ssh_cmd
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
39
|
+
result = ''
|
40
|
+
begin
|
41
|
+
action = send(:check_user_id, command, attributes)
|
42
|
+
ssh_cmd = build_full_command(action)
|
43
|
+
response = send_eqcmd(ssh_cmd)
|
44
|
+
result = post_processing(command, response)
|
45
|
+
rescue ArgumentError, NoMethodError => error
|
46
|
+
result = "#{error.message} -- :#{command} using #{attributes}"
|
47
47
|
end
|
48
|
-
return
|
48
|
+
return result
|
49
49
|
end
|
50
50
|
|
51
51
|
private
|
@@ -3,6 +3,20 @@ module EquitracUtilities
|
|
3
3
|
# @note Equitrac Administration Guide - https://download.equitrac.com/271828/EE5.6/Docs/Administration_Guide.pdf
|
4
4
|
module UserActions
|
5
5
|
|
6
|
+
|
7
|
+
# Be sure Actions have correct user_id data
|
8
|
+
#
|
9
|
+
# @param action [Symbol] the action to be formatted
|
10
|
+
# @return [String] this attribute MUST include: { user_id: "userid" }
|
11
|
+
def check_user_id(action, attribs)
|
12
|
+
attribs[:user_id] = attribs[:user_id]&.strip
|
13
|
+
answer = send(action, attribs)
|
14
|
+
raise ArgumentError, "missing user_id" if attribs[:user_id].nil? or
|
15
|
+
attribs[:user_id].empty?
|
16
|
+
raise ArgumentError, "user_id has space" if attribs[:user_id].include?(' ')
|
17
|
+
return answer
|
18
|
+
end
|
19
|
+
|
6
20
|
# Get Equitrac User Info
|
7
21
|
#
|
8
22
|
# @param attr [Hash] this attribute MUST include: { user_id: "userid" }
|