python-rac 0.2.0__py3-none-any.whl
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.
- pyrac/__init__.py +4 -0
- pyrac/__main__.py +4 -0
- pyrac/cli.py +921 -0
- pyrac/client.py +2382 -0
- pyrac/desktop.py +5003 -0
- pyrac/legacy.py +8 -0
- pyrac/mcp_server.py +3845 -0
- pyrac/protocol/__init__.py +0 -0
- pyrac/protocol/v851.py +32 -0
- pyrac/protocol/v851_client.py +3453 -0
- pyrac/read_service.py +831 -0
- pyrac/v8311.py +1400 -0
- pyrac/web/__init__.py +0 -0
- pyrac/web/__main__.py +355 -0
- pyrac/web/app.py +2835 -0
- pyrac/web/workspace.py +1905 -0
- python_rac-0.2.0.dist-info/METADATA +843 -0
- python_rac-0.2.0.dist-info/RECORD +22 -0
- python_rac-0.2.0.dist-info/WHEEL +5 -0
- python_rac-0.2.0.dist-info/entry_points.txt +5 -0
- python_rac-0.2.0.dist-info/licenses/LICENSE +21 -0
- python_rac-0.2.0.dist-info/top_level.txt +1 -0
pyrac/cli.py
ADDED
|
@@ -0,0 +1,921 @@
|
|
|
1
|
+
"""Command-line adapter around the library; no wire format handling here."""
|
|
2
|
+
import argparse
|
|
3
|
+
import asyncio
|
|
4
|
+
from pprint import pprint
|
|
5
|
+
from uuid import UUID
|
|
6
|
+
from . import client as client_module
|
|
7
|
+
from .client import RacClient, RacError, UnsupportedFeatureError
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Version negotiation is allowed only for commands that cannot mutate either RAS.
|
|
11
|
+
# Keep an explicit allowlist so adding a new CLI action fails closed.
|
|
12
|
+
AUTO_READ_ACTIONS = {
|
|
13
|
+
'agent': frozenset({'version', 'admin'}),
|
|
14
|
+
'cluster': frozenset({'list', 'info', 'admin'}),
|
|
15
|
+
'manager': frozenset({'list', 'info'}),
|
|
16
|
+
'service': frozenset({'list'}),
|
|
17
|
+
'session': frozenset({'list', 'info'}),
|
|
18
|
+
'profile': frozenset({'list', 'acl'}),
|
|
19
|
+
'counter': frozenset({'list', 'info', 'values', 'accumulated-values'}),
|
|
20
|
+
'limit': frozenset({'list', 'info'}),
|
|
21
|
+
'connection': frozenset({'list', 'info'}),
|
|
22
|
+
'service-setting': frozenset({'list', 'info', 'get-service-data-dirs-for-transfer'}),
|
|
23
|
+
'lock': frozenset({'list'}),
|
|
24
|
+
'rule': frozenset({'list', 'info'}),
|
|
25
|
+
'server': frozenset({'list', 'info'}),
|
|
26
|
+
'process': frozenset({'list', 'info'}),
|
|
27
|
+
'infobase': frozenset({'info', 'summary'}),
|
|
28
|
+
'binary-data-storage': frozenset({'list'}),
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _auto_read_only(args):
|
|
33
|
+
if args.action not in AUTO_READ_ACTIONS.get(args.command, ()):
|
|
34
|
+
return False
|
|
35
|
+
if args.command in ('agent', 'cluster') and args.action == 'admin':
|
|
36
|
+
return args.detail == 'list'
|
|
37
|
+
if args.command == 'profile' and args.action == 'acl':
|
|
38
|
+
return args.acl_action == 'list'
|
|
39
|
+
if args.command == 'infobase' and args.action == 'summary':
|
|
40
|
+
return args.detail in ('list', 'info')
|
|
41
|
+
return True
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def build_parser():
|
|
45
|
+
parser = argparse.ArgumentParser(description='1C RAC administration client')
|
|
46
|
+
parser.add_argument('--ras-host', default='localhost')
|
|
47
|
+
parser.add_argument('--ras-port', type=int, default=1545)
|
|
48
|
+
parser.add_argument('--protocol', choices=['10.0', '16.0', 'auto'], default='16.0')
|
|
49
|
+
parser.add_argument('--agent-user')
|
|
50
|
+
sub = parser.add_subparsers(dest='command', required=True)
|
|
51
|
+
agent = sub.add_parser('agent')
|
|
52
|
+
agent_actions = agent.add_subparsers(dest='action', required=True)
|
|
53
|
+
agent_actions.add_parser('version')
|
|
54
|
+
agent_admin_actions = agent_actions.add_parser('admin').add_subparsers(dest='detail', required=True)
|
|
55
|
+
agent_admin_actions.add_parser('list')
|
|
56
|
+
register = agent_admin_actions.add_parser('register')
|
|
57
|
+
register.add_argument('--name', required=True)
|
|
58
|
+
register.add_argument('--os-user', required=True)
|
|
59
|
+
register.add_argument('--descr', default='')
|
|
60
|
+
agent_admin_actions.add_parser('remove').add_argument('--name', required=True)
|
|
61
|
+
for name in ('manager', 'service', 'session', 'profile', 'counter', 'limit', 'connection'):
|
|
62
|
+
group = sub.add_parser(name)
|
|
63
|
+
group.add_argument('--cluster', required=True)
|
|
64
|
+
actions = group.add_subparsers(dest='action', required=True)
|
|
65
|
+
listing = actions.add_parser('list')
|
|
66
|
+
if name == 'profile':
|
|
67
|
+
update = actions.add_parser('update')
|
|
68
|
+
update.add_argument('--name', required=True)
|
|
69
|
+
update.add_argument('--descr')
|
|
70
|
+
update.add_argument('--config', choices=('yes', 'no'))
|
|
71
|
+
priv_options = update.add_mutually_exclusive_group()
|
|
72
|
+
priv_options.add_argument('--priv', choices=('yes', 'no'))
|
|
73
|
+
priv_options.add_argument('--full-privileged-mode', choices=('yes', 'no'))
|
|
74
|
+
update.add_argument('--crypto', choices=('yes', 'no'))
|
|
75
|
+
update.add_argument('--directory-access', choices=('list', 'full'))
|
|
76
|
+
update.add_argument('--com-access', choices=('list', 'full'))
|
|
77
|
+
update.add_argument('--addin-access', choices=('list', 'full'))
|
|
78
|
+
update.add_argument('--module-access', choices=('list', 'full'))
|
|
79
|
+
update.add_argument('--app-access', choices=('list', 'full'))
|
|
80
|
+
update.add_argument('--inet-access', choices=('list', 'full'))
|
|
81
|
+
update.add_argument('--right-extension', choices=('yes', 'no'))
|
|
82
|
+
update.add_argument('--all-modules-extension', choices=('yes', 'no'))
|
|
83
|
+
update.add_argument('--right-extension-definition-roles')
|
|
84
|
+
update.add_argument('--privileged-mode-roles')
|
|
85
|
+
update.add_argument('--modules-available-for-extension')
|
|
86
|
+
update.add_argument('--modules-not-available-for-extension')
|
|
87
|
+
actions.add_parser('remove').add_argument('--name', required=True)
|
|
88
|
+
acl = actions.add_parser('acl')
|
|
89
|
+
acl_types = acl.add_subparsers(dest='acl_type', required=True)
|
|
90
|
+
for acl_type in ('directory', 'com', 'addin', 'module', 'app', 'inet'):
|
|
91
|
+
acl_group = acl_types.add_parser(acl_type)
|
|
92
|
+
acl_actions = acl_group.add_subparsers(dest='acl_action', required=True)
|
|
93
|
+
acl_actions.add_parser('list').add_argument('--name', required=True)
|
|
94
|
+
if acl_type == 'directory':
|
|
95
|
+
directory_update = acl_actions.add_parser('update')
|
|
96
|
+
directory_update.add_argument('--name', required=True)
|
|
97
|
+
directory_update.add_argument('--alias', required=True)
|
|
98
|
+
directory_update.add_argument('--physicalPath')
|
|
99
|
+
directory_update.add_argument('--descr')
|
|
100
|
+
directory_update.add_argument('--allowedRead', choices=('yes', 'no'))
|
|
101
|
+
directory_update.add_argument('--allowedWrite', choices=('yes', 'no'))
|
|
102
|
+
if acl_type == 'app':
|
|
103
|
+
app_update = acl_actions.add_parser('update')
|
|
104
|
+
app_update.add_argument('--name', required=True)
|
|
105
|
+
app_update.add_argument('--item-name', required=True)
|
|
106
|
+
app_update.add_argument('--wild')
|
|
107
|
+
app_update.add_argument('--descr')
|
|
108
|
+
if acl_type == 'addin':
|
|
109
|
+
addin_update = acl_actions.add_parser('update')
|
|
110
|
+
addin_update.add_argument('--name', required=True)
|
|
111
|
+
addin_update.add_argument('--item-name', required=True)
|
|
112
|
+
addin_update.add_argument('--hash')
|
|
113
|
+
addin_update.add_argument('--descr')
|
|
114
|
+
if acl_type == 'module':
|
|
115
|
+
module_update = acl_actions.add_parser('update')
|
|
116
|
+
module_update.add_argument('--name', required=True)
|
|
117
|
+
module_update.add_argument('--item-name', required=True)
|
|
118
|
+
module_update.add_argument('--hash')
|
|
119
|
+
module_update.add_argument('--descr')
|
|
120
|
+
if acl_type == 'com':
|
|
121
|
+
com_update = acl_actions.add_parser('update')
|
|
122
|
+
com_update.add_argument('--name', required=True)
|
|
123
|
+
com_update.add_argument('--item-name', required=True)
|
|
124
|
+
for field in ('fileName', 'id', 'host', 'descr'):
|
|
125
|
+
com_update.add_argument('--' + field)
|
|
126
|
+
if acl_type == 'inet':
|
|
127
|
+
inet_update = acl_actions.add_parser('update')
|
|
128
|
+
inet_update.add_argument('--name', required=True)
|
|
129
|
+
inet_update.add_argument('--item-name', required=True)
|
|
130
|
+
inet_update.add_argument('--url')
|
|
131
|
+
inet_update.add_argument('--port', type=int)
|
|
132
|
+
inet_update.add_argument('--protocol', dest='inet_protocol')
|
|
133
|
+
inet_update.add_argument('--descr')
|
|
134
|
+
if acl_type in ('app', 'module', 'addin', 'inet', 'com', 'directory'):
|
|
135
|
+
remove = acl_actions.add_parser('remove')
|
|
136
|
+
remove.add_argument('--name', required=True)
|
|
137
|
+
if acl_type == 'directory':
|
|
138
|
+
remove.add_argument('--alias', required=True)
|
|
139
|
+
else:
|
|
140
|
+
remove.add_argument('--item-name', required=True)
|
|
141
|
+
if name in ('session', 'connection'):
|
|
142
|
+
listing.add_argument('--infobase')
|
|
143
|
+
if name == 'connection':
|
|
144
|
+
listing.add_argument('--process')
|
|
145
|
+
if name == 'session':
|
|
146
|
+
actions.add_parser('info').add_argument('--session', required=True)
|
|
147
|
+
if name in ('manager', 'connection'):
|
|
148
|
+
actions.add_parser('info').add_argument('--' + name, required=True)
|
|
149
|
+
if name == 'limit':
|
|
150
|
+
actions.add_parser('remove').add_argument('--name', required=True)
|
|
151
|
+
limit_update = actions.add_parser('update')
|
|
152
|
+
limit_update.add_argument('--name', required=True)
|
|
153
|
+
limit_update.add_argument('--action', dest='limit_action', choices=(
|
|
154
|
+
'none', 'set-low-priority-thread', 'interrupt-current-call',
|
|
155
|
+
'interrupt-session'))
|
|
156
|
+
limit_update.add_argument('--counter')
|
|
157
|
+
limit_update.add_argument('--error-message')
|
|
158
|
+
limit_update.add_argument('--descr')
|
|
159
|
+
for field in ('duration', 'cpu-time', 'memory', 'read', 'write',
|
|
160
|
+
'duration-dbms', 'dbms-bytes', 'service', 'call',
|
|
161
|
+
'number-of-active-sessions', 'number-of-sessions'):
|
|
162
|
+
limit_update.add_argument('--' + field, type=int)
|
|
163
|
+
actions.add_parser('info').add_argument('--limit', required=True)
|
|
164
|
+
if name == 'counter':
|
|
165
|
+
clear = actions.add_parser('clear')
|
|
166
|
+
clear.add_argument('--counter', required=True)
|
|
167
|
+
clear.add_argument('--object', default='')
|
|
168
|
+
actions.add_parser('remove').add_argument('--name', required=True)
|
|
169
|
+
counter_update = actions.add_parser('update')
|
|
170
|
+
counter_update.add_argument('--name', required=True)
|
|
171
|
+
counter_update.add_argument('--collection-time', type=int)
|
|
172
|
+
counter_update.add_argument('--group', choices=('users', 'data-separation'))
|
|
173
|
+
counter_update.add_argument('--filter-type', choices=('all-selected', 'all-but-selected', 'all'))
|
|
174
|
+
counter_update.add_argument('--filter')
|
|
175
|
+
counter_update.add_argument('--descr')
|
|
176
|
+
for field in ('duration', 'cpu-time', 'memory', 'read', 'write', 'duration-dbms',
|
|
177
|
+
'dbms-bytes', 'service', 'call', 'number-of-active-sessions',
|
|
178
|
+
'number-of-sessions'):
|
|
179
|
+
counter_update.add_argument('--' + field, choices=('analyze', 'not-analyze'))
|
|
180
|
+
actions.add_parser('info').add_argument('--counter', required=True)
|
|
181
|
+
for action in ('values', 'accumulated-values'):
|
|
182
|
+
values = actions.add_parser(action)
|
|
183
|
+
values.add_argument('--counter', required=True)
|
|
184
|
+
values.add_argument('--object', default='')
|
|
185
|
+
setting = sub.add_parser('service-setting')
|
|
186
|
+
setting.add_argument('--cluster', required=True)
|
|
187
|
+
setting.add_argument('--server', required=True)
|
|
188
|
+
setting_actions = setting.add_subparsers(dest='action', required=True)
|
|
189
|
+
setting_actions.add_parser('list')
|
|
190
|
+
insert = setting_actions.add_parser('insert')
|
|
191
|
+
insert.add_argument('--service-name', required=True)
|
|
192
|
+
insert.add_argument('--infobase-name', default='')
|
|
193
|
+
insert.add_argument('--service-data-dir', default='')
|
|
194
|
+
setting_update = setting_actions.add_parser('update')
|
|
195
|
+
setting_update.add_argument('--setting', required=True)
|
|
196
|
+
setting_update.add_argument('--service-data-dir', required=True)
|
|
197
|
+
setting_actions.add_parser('remove').add_argument('--setting', required=True)
|
|
198
|
+
setting_actions.add_parser('apply')
|
|
199
|
+
setting_actions.add_parser('info').add_argument('--setting', required=True)
|
|
200
|
+
transfer = setting_actions.add_parser('get-service-data-dirs-for-transfer')
|
|
201
|
+
transfer.add_argument('--service-name', default='')
|
|
202
|
+
lock = sub.add_parser('lock')
|
|
203
|
+
lock.add_argument('--cluster', required=True)
|
|
204
|
+
lock_list = lock.add_subparsers(dest='action', required=True).add_parser('list')
|
|
205
|
+
lock_filters = lock_list.add_mutually_exclusive_group()
|
|
206
|
+
for field in ('infobase', 'connection', 'session'):
|
|
207
|
+
lock_filters.add_argument('--' + field)
|
|
208
|
+
rule = sub.add_parser('rule')
|
|
209
|
+
rule.add_argument('--cluster', required=True)
|
|
210
|
+
rule_actions = rule.add_subparsers(dest='action', required=True)
|
|
211
|
+
rule_actions.add_parser('list').add_argument('--server', required=True)
|
|
212
|
+
rule_info = rule_actions.add_parser('info')
|
|
213
|
+
rule_info.add_argument('--server', required=True)
|
|
214
|
+
rule_info.add_argument('--rule', required=True)
|
|
215
|
+
rule_insert = rule_actions.add_parser('insert')
|
|
216
|
+
rule_insert.add_argument('--server', required=True)
|
|
217
|
+
rule_insert.add_argument('--position', type=int, required=True)
|
|
218
|
+
rule_insert.add_argument('--object-type', default='')
|
|
219
|
+
rule_insert.add_argument('--infobase-name', default='')
|
|
220
|
+
rule_insert.add_argument('--rule-type', choices=('never', 'auto', 'always'), default='auto')
|
|
221
|
+
rule_insert.add_argument('--application-ext', default='')
|
|
222
|
+
rule_insert.add_argument('--priority', type=int, default=0)
|
|
223
|
+
rule_remove = rule_actions.add_parser('remove')
|
|
224
|
+
rule_remove.add_argument('--server', required=True)
|
|
225
|
+
rule_remove.add_argument('--rule', required=True)
|
|
226
|
+
rule_update = rule_actions.add_parser('update')
|
|
227
|
+
rule_update.add_argument('--server', required=True)
|
|
228
|
+
rule_update.add_argument('--rule', required=True)
|
|
229
|
+
rule_update.add_argument('--position', type=int, required=True)
|
|
230
|
+
rule_update.add_argument('--object-type')
|
|
231
|
+
rule_update.add_argument('--infobase-name')
|
|
232
|
+
rule_update.add_argument('--rule-type', choices=('never', 'auto', 'always'))
|
|
233
|
+
rule_update.add_argument('--application-ext')
|
|
234
|
+
rule_update.add_argument('--priority', type=int)
|
|
235
|
+
rule_apply = rule_actions.add_parser('apply')
|
|
236
|
+
apply_mode = rule_apply.add_mutually_exclusive_group()
|
|
237
|
+
apply_mode.add_argument('--full', dest='full', action='store_true', default=True)
|
|
238
|
+
apply_mode.add_argument('--partial', dest='full', action='store_false')
|
|
239
|
+
cluster = sub.add_parser('cluster')
|
|
240
|
+
cluster_sub = cluster.add_subparsers(dest='action', required=True)
|
|
241
|
+
cluster_sub.add_parser('list')
|
|
242
|
+
cluster_sub.add_parser('remove').add_argument('--cluster', required=True)
|
|
243
|
+
cluster_insert = cluster_sub.add_parser('insert')
|
|
244
|
+
cluster_insert.add_argument('--host', required=True)
|
|
245
|
+
cluster_insert.add_argument('--port', type=int, required=True)
|
|
246
|
+
cluster_insert.add_argument('--name', default='')
|
|
247
|
+
cluster_insert.add_argument('--expiration-timeout', type=int)
|
|
248
|
+
cluster_insert.add_argument('--security-level', type=int)
|
|
249
|
+
cluster_insert.add_argument('--session-fault-tolerance-level', type=int)
|
|
250
|
+
cluster_insert.add_argument('--load-balancing-mode', choices=('performance', 'memory'))
|
|
251
|
+
cluster_insert.add_argument('--kill-problem-processes', choices=('yes', 'no'))
|
|
252
|
+
cluster_insert.add_argument('--kill-by-memory-with-dump', choices=('yes', 'no'))
|
|
253
|
+
cluster_insert.add_argument('--allow-access-right-audit-events-recording', choices=('yes', 'no'))
|
|
254
|
+
cluster_insert.add_argument('--restart-schedule')
|
|
255
|
+
cluster_insert.add_argument('--ping-period', type=int)
|
|
256
|
+
cluster_insert.add_argument('--ping-timeout', type=int)
|
|
257
|
+
cluster_admin = cluster_sub.add_parser('admin')
|
|
258
|
+
cluster_admin.add_argument('--cluster', required=True)
|
|
259
|
+
cluster_admin.add_argument('--cluster-user')
|
|
260
|
+
cluster_admin_actions = cluster_admin.add_subparsers(dest='detail', required=True)
|
|
261
|
+
cluster_admin_actions.add_parser('list')
|
|
262
|
+
register = cluster_admin_actions.add_parser('register')
|
|
263
|
+
register.add_argument('--name', required=True)
|
|
264
|
+
register.add_argument('--os-user', required=True)
|
|
265
|
+
register.add_argument('--descr', default='')
|
|
266
|
+
cluster_admin_actions.add_parser('remove').add_argument('--name', required=True)
|
|
267
|
+
for action in ('info', 'update'):
|
|
268
|
+
target = cluster_sub.add_parser(action)
|
|
269
|
+
target.add_argument('--cluster', required=True)
|
|
270
|
+
if action == 'update':
|
|
271
|
+
updates = target.add_mutually_exclusive_group(required=True)
|
|
272
|
+
updates.add_argument('--restart-schedule')
|
|
273
|
+
updates.add_argument('--name')
|
|
274
|
+
updates.add_argument('--expiration-timeout', type=int)
|
|
275
|
+
updates.add_argument('--security-level', type=int)
|
|
276
|
+
updates.add_argument('--session-fault-tolerance-level', type=int)
|
|
277
|
+
updates.add_argument('--load-balancing-mode', choices=('performance', 'memory'))
|
|
278
|
+
updates.add_argument('--kill-problem-processes', choices=('yes', 'no'))
|
|
279
|
+
updates.add_argument('--kill-by-memory-with-dump', choices=('yes', 'no'))
|
|
280
|
+
updates.add_argument('--allow-access-right-audit-events-recording', choices=('yes', 'no'))
|
|
281
|
+
updates.add_argument('--ping-period', type=int)
|
|
282
|
+
target.add_argument('--ping-timeout', type=int)
|
|
283
|
+
server = sub.add_parser('server')
|
|
284
|
+
process = sub.add_parser('process')
|
|
285
|
+
infobase = sub.add_parser('infobase')
|
|
286
|
+
for group in (server, process):
|
|
287
|
+
group.add_argument('--cluster', required=True)
|
|
288
|
+
group.add_argument('--cluster-user')
|
|
289
|
+
group.add_argument('--cluster-pwd')
|
|
290
|
+
actions = group.add_subparsers(dest='action', required=True)
|
|
291
|
+
actions.add_parser('list')
|
|
292
|
+
if group is process:
|
|
293
|
+
actions.choices['list'].add_argument('--server')
|
|
294
|
+
actions.add_parser('info').add_argument('--process', required=True)
|
|
295
|
+
actions.add_parser('turn-off').add_argument('--process', required=True)
|
|
296
|
+
if group is server:
|
|
297
|
+
info = actions.add_parser('info')
|
|
298
|
+
info.add_argument('--server', required=True)
|
|
299
|
+
update = actions.add_parser('update')
|
|
300
|
+
update.add_argument('--server', required=True)
|
|
301
|
+
updates = update.add_mutually_exclusive_group(required=True)
|
|
302
|
+
updates.add_argument('--restart-schedule')
|
|
303
|
+
updates.add_argument('--infobases-limit', type=int)
|
|
304
|
+
updates.add_argument('--connections-limit', type=int)
|
|
305
|
+
updates.add_argument('--safe-call-memory-limit', type=int)
|
|
306
|
+
updates.add_argument('--service-principal-name')
|
|
307
|
+
updates.add_argument('--critical-total-memory', type=int)
|
|
308
|
+
updates.add_argument('--temporary-allowed-total-memory', type=int)
|
|
309
|
+
updates.add_argument('--temporary-allowed-total-memory-time-limit', type=int)
|
|
310
|
+
updates.add_argument('--dedicate-managers', choices=['all', 'none'])
|
|
311
|
+
updates.add_argument('--port-range', action='append', dest='port_ranges')
|
|
312
|
+
infobase.add_argument('--cluster', required=True)
|
|
313
|
+
infobase.add_argument('--cluster-user')
|
|
314
|
+
infobase.add_argument('--cluster-pwd')
|
|
315
|
+
infobase_actions = infobase.add_subparsers(dest='action', required=True)
|
|
316
|
+
infobase_info = infobase_actions.add_parser('info')
|
|
317
|
+
info_selector = infobase_info.add_mutually_exclusive_group(required=True)
|
|
318
|
+
info_selector.add_argument('--infobase')
|
|
319
|
+
info_selector.add_argument('--name')
|
|
320
|
+
infobase_update = infobase_actions.add_parser('update')
|
|
321
|
+
infobase_update.add_argument('--infobase', required=True)
|
|
322
|
+
updates = infobase_update.add_mutually_exclusive_group(required=True)
|
|
323
|
+
updates.add_argument('--descr')
|
|
324
|
+
updates.add_argument('--security-profile-name')
|
|
325
|
+
updates.add_argument('--safe-mode-security-profile-name')
|
|
326
|
+
updates.add_argument('--scheduled-jobs-deny', choices=('on', 'off'))
|
|
327
|
+
updates.add_argument('--sessions-deny', choices=('on', 'off'))
|
|
328
|
+
updates.add_argument('--license-distribution', choices=('allow', 'deny'))
|
|
329
|
+
updates.add_argument('--denied-message')
|
|
330
|
+
updates.add_argument('--reserve-working-processes', choices=('yes', 'no'))
|
|
331
|
+
updates.add_argument('--external-session-manager-required', choices=('yes', 'no'))
|
|
332
|
+
updates.add_argument('--disable-local-speech-to-text', choices=('yes', 'no'))
|
|
333
|
+
updates.add_argument('--configuration-unload-delay-by-working-process-without-active-users',
|
|
334
|
+
type=int)
|
|
335
|
+
updates.add_argument('--minimum-scheduled-jobs-start-period-without-active-users', type=int)
|
|
336
|
+
updates.add_argument('--maximum-scheduled-jobs-start-shift-without-active-users', type=int)
|
|
337
|
+
infobase_create = infobase_actions.add_parser('create')
|
|
338
|
+
for option in ('name', 'db-name', 'db-server', 'db-user', 'locale'):
|
|
339
|
+
infobase_create.add_argument('--' + option, required=True)
|
|
340
|
+
infobase_create.add_argument('--descr', default='')
|
|
341
|
+
infobase_create.add_argument('--scheduled-jobs-deny', choices=('on', 'off'), default='off')
|
|
342
|
+
infobase_create.add_argument('--license-distribution', choices=('allow', 'deny'), default='deny')
|
|
343
|
+
infobase_create.add_argument('--date-offset', type=int, choices=(0, 2000), default=0)
|
|
344
|
+
infobase_create.add_argument('--security-level', type=int, choices=(0, 1), default=0)
|
|
345
|
+
database_policy_create = infobase_create.add_mutually_exclusive_group(required=True)
|
|
346
|
+
database_policy_create.add_argument('--create-database', action='store_true')
|
|
347
|
+
database_policy_create.add_argument('--use-existing-database', action='store_false',
|
|
348
|
+
dest='create_database')
|
|
349
|
+
infobase_drop = infobase_actions.add_parser('drop')
|
|
350
|
+
infobase_drop.add_argument('--infobase', required=True)
|
|
351
|
+
database_policy = infobase_drop.add_mutually_exclusive_group(required=True)
|
|
352
|
+
database_policy.add_argument('--drop-database', action='store_true')
|
|
353
|
+
database_policy.add_argument('--keep-database', action='store_true')
|
|
354
|
+
database_policy.add_argument('--clear-database', action='store_true')
|
|
355
|
+
summary = infobase_actions.add_parser('summary')
|
|
356
|
+
summary_actions = summary.add_subparsers(dest='detail', required=True)
|
|
357
|
+
summary_actions.add_parser('list')
|
|
358
|
+
summary_info = summary_actions.add_parser('info')
|
|
359
|
+
summary_selector = summary_info.add_mutually_exclusive_group(required=True)
|
|
360
|
+
summary_selector.add_argument('--infobase')
|
|
361
|
+
summary_selector.add_argument('--name')
|
|
362
|
+
summary_update = summary_actions.add_parser('update')
|
|
363
|
+
summary_update.add_argument('--infobase', required=True)
|
|
364
|
+
summary_update.add_argument('--descr', required=True)
|
|
365
|
+
storage = sub.add_parser('binary-data-storage')
|
|
366
|
+
storage.add_argument('--cluster', required=True)
|
|
367
|
+
storage.add_argument('--cluster-user')
|
|
368
|
+
storage.add_argument('--cluster-pwd')
|
|
369
|
+
storage.add_subparsers(dest='action', required=True).add_parser('list').add_argument(
|
|
370
|
+
'--infobase', required=True)
|
|
371
|
+
return parser
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
async def run(args):
|
|
375
|
+
if args.protocol == 'auto' and not _auto_read_only(args):
|
|
376
|
+
raise UnsupportedFeatureError('Protocol auto is read-only in the CLI; select 16.0 explicitly for mutations')
|
|
377
|
+
if args.protocol in ('16.0', 'auto') and any(getattr(args, key, None) is not None
|
|
378
|
+
for key in ('cluster_pwd', 'agent_pwd')):
|
|
379
|
+
raise UnsupportedFeatureError('Password arguments are not accepted by the 16.0/auto CLI')
|
|
380
|
+
if (args.command == 'cluster' and args.action in ('insert', 'update')
|
|
381
|
+
and (args.ping_period is None) != (args.ping_timeout is None)):
|
|
382
|
+
raise ValueError('Cluster ping-period and ping-timeout must be supplied together')
|
|
383
|
+
if (args.command == 'cluster' and args.action == 'update'
|
|
384
|
+
and args.ping_period is not None
|
|
385
|
+
and not (args.ping_period == args.ping_timeout == 0
|
|
386
|
+
or 0 < args.ping_period < args.ping_timeout < 2**31)):
|
|
387
|
+
raise ValueError('Invalid cluster ping period/timeout pair')
|
|
388
|
+
# Parse every UUID selector before entering the context: 16.0 opens a TCP
|
|
389
|
+
# endpoint in __aenter__, so a malformed selector must not reach RAS.
|
|
390
|
+
for field in ('cluster', 'server', 'process', 'infobase', 'connection',
|
|
391
|
+
'session', 'manager', 'setting', 'rule'):
|
|
392
|
+
if (value := getattr(args, field, None)) is not None:
|
|
393
|
+
UUID(value)
|
|
394
|
+
if args.command == 'infobase' and args.action == 'create':
|
|
395
|
+
for field in ('name', 'db_name', 'db_server', 'db_user', 'locale'):
|
|
396
|
+
value = getattr(args, field)
|
|
397
|
+
if not value or '\x00' in value or len(value.encode('utf-8')) > 255:
|
|
398
|
+
raise ValueError('Invalid infobase ' + field)
|
|
399
|
+
if '\x00' in args.descr or len(args.descr.encode('utf-8')) > 1024:
|
|
400
|
+
raise ValueError('Invalid infobase description')
|
|
401
|
+
if args.command == 'infobase' and (args.action == 'update' or
|
|
402
|
+
args.action == 'summary' and args.detail == 'update'):
|
|
403
|
+
for field in ('descr', 'security_profile_name', 'safe_mode_security_profile_name',
|
|
404
|
+
'denied_message'):
|
|
405
|
+
value = getattr(args, field, None)
|
|
406
|
+
if value is not None and ('\x00' in value or
|
|
407
|
+
field != 'denied_message' and len(value.encode('utf-8')) > 1024):
|
|
408
|
+
raise ValueError('Invalid infobase update field')
|
|
409
|
+
for field, maximum in (
|
|
410
|
+
('configuration_unload_delay_by_working_process_without_active_users', 0xffffffff),
|
|
411
|
+
('minimum_scheduled_jobs_start_period_without_active_users', 0xffffffff),
|
|
412
|
+
('maximum_scheduled_jobs_start_shift_without_active_users', 255)):
|
|
413
|
+
value = getattr(args, field, None)
|
|
414
|
+
if value is not None and not 0 <= value <= maximum:
|
|
415
|
+
raise ValueError('Invalid infobase update numeric field')
|
|
416
|
+
if args.command == 'infobase' and (args.action == 'info' or
|
|
417
|
+
args.action == 'summary' and args.detail == 'info'):
|
|
418
|
+
name = args.name
|
|
419
|
+
if name is not None and (not name.strip() or '\x00' in name
|
|
420
|
+
or len(name.encode('utf-8')) > 1024):
|
|
421
|
+
raise ValueError('Invalid infobase name')
|
|
422
|
+
if args.command == 'profile' and args.action == 'acl' and args.acl_action == 'list':
|
|
423
|
+
name = args.name
|
|
424
|
+
if not name.strip() or '\x00' in name or len(name.encode('utf-8')) > 1024:
|
|
425
|
+
raise ValueError('Invalid security profile name')
|
|
426
|
+
if (args.command == 'service-setting' and
|
|
427
|
+
args.action == 'get-service-data-dirs-for-transfer'):
|
|
428
|
+
name = args.service_name
|
|
429
|
+
if '\x00' in name or len(name.encode('utf-8')) > 1024:
|
|
430
|
+
raise ValueError('Invalid service name')
|
|
431
|
+
if (args.command in ('agent', 'cluster') and args.action == 'admin'
|
|
432
|
+
and args.detail == 'register'):
|
|
433
|
+
for label, value in (('name', args.name), ('OS user', args.os_user),
|
|
434
|
+
('description', args.descr)):
|
|
435
|
+
if ((label != 'description' and not value) or '\x00' in value
|
|
436
|
+
or len(value.encode('utf-8')) > 1024):
|
|
437
|
+
raise ValueError('Invalid administrator ' + label)
|
|
438
|
+
if ((args.command in ('agent', 'cluster') and args.action == 'admin'
|
|
439
|
+
and args.detail == 'remove') or
|
|
440
|
+
(args.command in ('profile', 'counter', 'limit') and args.action == 'remove')):
|
|
441
|
+
name = args.name
|
|
442
|
+
if not name.strip() or '\x00' in name or len(name.encode('utf-8')) > 1024:
|
|
443
|
+
raise ValueError('Invalid removal name')
|
|
444
|
+
if args.command == 'profile' and args.action == 'update':
|
|
445
|
+
if (not args.name.strip() or '\x00' in args.name
|
|
446
|
+
or len(args.name.encode('utf-8')) > 1024):
|
|
447
|
+
raise ValueError('Invalid security profile name')
|
|
448
|
+
for field in ('descr', 'right_extension_definition_roles', 'privileged_mode_roles',
|
|
449
|
+
'modules_available_for_extension', 'modules_not_available_for_extension'):
|
|
450
|
+
value = getattr(args, field)
|
|
451
|
+
if value is not None and ('\x00' in value or len(value.encode('utf-8')) > 1024):
|
|
452
|
+
raise ValueError('Invalid security profile field')
|
|
453
|
+
if args.command == 'profile' and args.action == 'acl' and args.acl_action in ('update', 'remove'):
|
|
454
|
+
item = args.alias if args.acl_type == 'directory' else args.item_name
|
|
455
|
+
for value in (args.name, item):
|
|
456
|
+
if not value.strip() or '\x00' in value or len(value.encode('utf-8')) > 1024:
|
|
457
|
+
raise ValueError('Invalid profile ACL selector')
|
|
458
|
+
if args.acl_action == 'update':
|
|
459
|
+
fields = {
|
|
460
|
+
'directory': ('physicalPath', 'descr'),
|
|
461
|
+
'app': ('wild', 'descr'),
|
|
462
|
+
'addin': ('hash', 'descr'),
|
|
463
|
+
'module': ('hash', 'descr'),
|
|
464
|
+
'com': ('fileName', 'id', 'host', 'descr'),
|
|
465
|
+
'inet': ('url', 'inet_protocol', 'descr'),
|
|
466
|
+
}[args.acl_type]
|
|
467
|
+
for field in fields:
|
|
468
|
+
value = getattr(args, field)
|
|
469
|
+
if value is not None and ('\x00' in value or len(value.encode('utf-8')) > 1024):
|
|
470
|
+
raise ValueError('Invalid profile ACL field')
|
|
471
|
+
if args.acl_type == 'inet':
|
|
472
|
+
acl_port = args.port
|
|
473
|
+
if acl_port is not None and not 0 <= acl_port <= 65535:
|
|
474
|
+
raise ValueError('Invalid profile internet ACL port')
|
|
475
|
+
if (args.command == 'cluster' and args.action == 'insert'
|
|
476
|
+
and not 1 <= args.port <= 65535):
|
|
477
|
+
raise ValueError('Invalid cluster port')
|
|
478
|
+
if args.command == 'cluster' and args.action == 'insert':
|
|
479
|
+
if (not args.host or '\x00' in args.host or len(args.host.encode('utf-8')) > 255
|
|
480
|
+
or '\x00' in args.name or len(args.name.encode('utf-8')) > 256):
|
|
481
|
+
raise ValueError('Invalid cluster insert parameters')
|
|
482
|
+
if any(value is not None and not 0 <= value < 2**31 for value in (
|
|
483
|
+
args.expiration_timeout, args.security_level,
|
|
484
|
+
args.session_fault_tolerance_level)):
|
|
485
|
+
raise ValueError('Invalid cluster insert numeric setting')
|
|
486
|
+
if (args.restart_schedule is not None and
|
|
487
|
+
('\x00' in args.restart_schedule or
|
|
488
|
+
(args.restart_schedule and
|
|
489
|
+
(len(args.restart_schedule.encode('utf-8')) > 256 or
|
|
490
|
+
len(args.restart_schedule.split()) != 6 or
|
|
491
|
+
any(not part.isascii() or not part.isdecimal()
|
|
492
|
+
for part in args.restart_schedule.split()))))):
|
|
493
|
+
raise ValueError('Invalid cluster restart schedule')
|
|
494
|
+
period = args.ping_period if args.ping_period is not None else 0
|
|
495
|
+
timeout = args.ping_timeout if args.ping_timeout is not None else 0
|
|
496
|
+
if not (period == timeout == 0 or 0 < period < timeout < 2**31):
|
|
497
|
+
raise ValueError('Invalid cluster ping period/timeout pair')
|
|
498
|
+
if args.command == 'cluster' and args.action == 'update':
|
|
499
|
+
if (args.name is not None and
|
|
500
|
+
('\x00' in args.name or (args.name and not args.name.strip())
|
|
501
|
+
or len(args.name.encode('utf-8')) > 256)):
|
|
502
|
+
raise ValueError('Invalid cluster name')
|
|
503
|
+
if any(value is not None and not 0 <= value < 2**31 for value in (
|
|
504
|
+
args.expiration_timeout, args.security_level,
|
|
505
|
+
args.session_fault_tolerance_level)):
|
|
506
|
+
raise ValueError('Invalid cluster numeric setting')
|
|
507
|
+
if args.restart_schedule is not None:
|
|
508
|
+
client_module.RacClient._validate_schedule(args.restart_schedule)
|
|
509
|
+
if args.command == 'rule' and args.action in ('insert', 'update'):
|
|
510
|
+
if not 0 <= args.position < 2**31:
|
|
511
|
+
raise ValueError('Invalid rule position')
|
|
512
|
+
if args.priority is not None and not -(2**31) <= args.priority < 2**31:
|
|
513
|
+
raise ValueError('Invalid rule priority')
|
|
514
|
+
for field in ('object_type', 'infobase_name', 'application_ext'):
|
|
515
|
+
value = getattr(args, field)
|
|
516
|
+
if value is not None and ('\x00' in value or len(value.encode('utf-8')) > 1024):
|
|
517
|
+
raise ValueError('Invalid rule field')
|
|
518
|
+
if args.command == 'service-setting' and args.action in ('insert', 'update'):
|
|
519
|
+
fields = ('service_name', 'infobase_name', 'service_data_dir') if args.action == 'insert' else (
|
|
520
|
+
'service_data_dir',)
|
|
521
|
+
for field in fields:
|
|
522
|
+
value = getattr(args, field)
|
|
523
|
+
if ('\x00' in value or len(value.encode('utf-8')) > 1024
|
|
524
|
+
or field == 'service_name' and not value.strip()):
|
|
525
|
+
raise ValueError('Invalid service setting field')
|
|
526
|
+
if args.command in ('counter', 'limit') and args.action in ('update', 'clear'):
|
|
527
|
+
name = args.counter if args.action == 'clear' else args.name
|
|
528
|
+
if (not isinstance(name, str) or not name.strip() or '\x00' in name
|
|
529
|
+
or len(name.encode('utf-8')) > 1024):
|
|
530
|
+
raise ValueError('Invalid counter or limit name')
|
|
531
|
+
if args.command == 'counter':
|
|
532
|
+
if args.action == 'clear':
|
|
533
|
+
if '\x00' in args.object or len(args.object.encode('utf-8')) > 4096:
|
|
534
|
+
raise ValueError('Invalid counter object filter')
|
|
535
|
+
else:
|
|
536
|
+
if args.collection_time is not None and not 0 <= args.collection_time < 2**63:
|
|
537
|
+
raise ValueError('Invalid collection time')
|
|
538
|
+
for field in ('filter', 'descr'):
|
|
539
|
+
value = getattr(args, field)
|
|
540
|
+
if value is not None and ('\x00' in value or len(value.encode('utf-8')) > 1024):
|
|
541
|
+
raise ValueError('Invalid counter field')
|
|
542
|
+
else:
|
|
543
|
+
for field in ('counter', 'error_message', 'descr'):
|
|
544
|
+
value = getattr(args, field)
|
|
545
|
+
if value is not None and ('\x00' in value or len(value.encode('utf-8')) > 1024):
|
|
546
|
+
raise ValueError('Invalid limit field')
|
|
547
|
+
for field in ('duration', 'cpu_time', 'memory', 'read', 'write',
|
|
548
|
+
'duration_dbms', 'dbms_bytes', 'service', 'call',
|
|
549
|
+
'number_of_active_sessions', 'number_of_sessions'):
|
|
550
|
+
value = getattr(args, field)
|
|
551
|
+
if value is not None and not 0 <= value < 2**63:
|
|
552
|
+
raise ValueError('Invalid limit threshold')
|
|
553
|
+
if (args.command == 'counter' and args.action in ('info', 'values', 'accumulated-values')
|
|
554
|
+
or args.command == 'limit' and args.action == 'info'):
|
|
555
|
+
name = args.counter if args.command == 'counter' else args.limit
|
|
556
|
+
if not name.strip() or '\x00' in name or len(name.encode('utf-8')) > 1024:
|
|
557
|
+
raise ValueError('Invalid counter or limit selector')
|
|
558
|
+
if args.command == 'counter' and args.action in ('values', 'accumulated-values'):
|
|
559
|
+
if '\x00' in args.object or len(args.object.encode('utf-8')) > 4096:
|
|
560
|
+
raise ValueError('Invalid counter object filter')
|
|
561
|
+
if args.command == 'server' and args.action == 'update':
|
|
562
|
+
for field, bits in (
|
|
563
|
+
('infobases_limit', 31), ('connections_limit', 31),
|
|
564
|
+
('safe_call_memory_limit', 63), ('critical_total_memory', 63),
|
|
565
|
+
('temporary_allowed_total_memory', 63),
|
|
566
|
+
('temporary_allowed_total_memory_time_limit', 63)):
|
|
567
|
+
value = getattr(args, field)
|
|
568
|
+
if value is not None and not 0 <= value < 2**bits:
|
|
569
|
+
raise ValueError('Invalid server numeric setting')
|
|
570
|
+
name = args.service_principal_name
|
|
571
|
+
if name is not None and ('\x00' in name or len(name.encode('utf-8')) > 256):
|
|
572
|
+
raise ValueError('Invalid server service principal name')
|
|
573
|
+
if args.restart_schedule is not None:
|
|
574
|
+
client_module.RacClient._validate_schedule(args.restart_schedule)
|
|
575
|
+
ranges = None
|
|
576
|
+
if (args.command == 'server' and args.action == 'update'
|
|
577
|
+
and getattr(args, 'port_ranges', None) is not None):
|
|
578
|
+
try:
|
|
579
|
+
ranges = [tuple(map(int, value.split(':'))) for value in args.port_ranges]
|
|
580
|
+
except ValueError as exc:
|
|
581
|
+
raise ValueError('Invalid server port range') from exc
|
|
582
|
+
if (not ranges or len(ranges) > 64
|
|
583
|
+
or any(len(pair) != 2 or any(not 1 <= port <= 65535 for port in pair)
|
|
584
|
+
or pair[0] > pair[1] for pair in ranges)):
|
|
585
|
+
raise ValueError('Invalid server port ranges')
|
|
586
|
+
ordered = sorted(ranges)
|
|
587
|
+
if any(left[1] >= right[0] for left, right in zip(ordered, ordered[1:])):
|
|
588
|
+
raise ValueError('Overlapping server port ranges')
|
|
589
|
+
async with RacClient(args.ras_host, args.ras_port, args.protocol,
|
|
590
|
+
cluster_user=getattr(args, 'cluster_user', None),
|
|
591
|
+
cluster_password=getattr(args, 'cluster_pwd', None),
|
|
592
|
+
agent_user=getattr(args, 'agent_user', None)) as client:
|
|
593
|
+
if args.command == 'agent':
|
|
594
|
+
if args.action == 'version':
|
|
595
|
+
return await client.agent_version()
|
|
596
|
+
if args.detail == 'register':
|
|
597
|
+
return await client.register_agent_admin(args.name, args.os_user, descr=args.descr)
|
|
598
|
+
if args.detail == 'remove':
|
|
599
|
+
return await client.remove_agent_admin(args.name)
|
|
600
|
+
return await client.list_agent_admins()
|
|
601
|
+
if args.command == 'manager':
|
|
602
|
+
if args.action == 'info':
|
|
603
|
+
return await client.get_manager(UUID(args.cluster), UUID(args.manager))
|
|
604
|
+
return await client.list_managers(UUID(args.cluster))
|
|
605
|
+
if args.command == 'service':
|
|
606
|
+
return await client.list_services(UUID(args.cluster))
|
|
607
|
+
if args.command == 'connection':
|
|
608
|
+
if args.action == 'info':
|
|
609
|
+
return await client.get_connection(UUID(args.cluster), UUID(args.connection))
|
|
610
|
+
return await client.list_connections(
|
|
611
|
+
UUID(args.cluster), UUID(args.infobase) if args.infobase else None,
|
|
612
|
+
process_id=UUID(args.process) if args.process else None)
|
|
613
|
+
if args.command == 'service-setting':
|
|
614
|
+
if args.action == 'apply':
|
|
615
|
+
return await client.apply_service_settings(UUID(args.cluster), UUID(args.server))
|
|
616
|
+
if args.action == 'remove':
|
|
617
|
+
return await client.remove_service_setting(
|
|
618
|
+
UUID(args.cluster), UUID(args.server), UUID(args.setting))
|
|
619
|
+
if args.action == 'update':
|
|
620
|
+
return await client.update_service_setting(
|
|
621
|
+
UUID(args.cluster), UUID(args.server), UUID(args.setting), args.service_data_dir)
|
|
622
|
+
if args.action == 'insert':
|
|
623
|
+
return await client.insert_service_setting(
|
|
624
|
+
UUID(args.cluster), UUID(args.server), args.service_name,
|
|
625
|
+
infobase_name=args.infobase_name, service_data_dir=args.service_data_dir)
|
|
626
|
+
cluster, server = UUID(args.cluster), UUID(args.server)
|
|
627
|
+
if args.action == 'list':
|
|
628
|
+
return await client.list_service_settings(cluster, server)
|
|
629
|
+
if args.action == 'info':
|
|
630
|
+
return await client.get_service_setting(cluster, server, UUID(args.setting))
|
|
631
|
+
return await client.list_service_data_dirs_for_transfer(cluster, server, args.service_name)
|
|
632
|
+
if args.command == 'lock':
|
|
633
|
+
return await client.list_locks(
|
|
634
|
+
UUID(args.cluster), **{field + '_id': UUID(value) for field in
|
|
635
|
+
('infobase', 'connection', 'session')
|
|
636
|
+
if (value := getattr(args, field)) is not None})
|
|
637
|
+
if args.command == 'rule':
|
|
638
|
+
if args.action == 'apply':
|
|
639
|
+
return await client.apply_rules(UUID(args.cluster), full=args.full)
|
|
640
|
+
if args.action == 'update':
|
|
641
|
+
return await client.update_rule(
|
|
642
|
+
UUID(args.cluster), UUID(args.server), UUID(args.rule), args.position,
|
|
643
|
+
**{field: value for field in ('object_type', 'infobase_name',
|
|
644
|
+
'rule_type', 'application_ext', 'priority')
|
|
645
|
+
if (value := getattr(args, field)) is not None})
|
|
646
|
+
if args.action == 'remove':
|
|
647
|
+
return await client.remove_rule(UUID(args.cluster), UUID(args.server), UUID(args.rule))
|
|
648
|
+
if args.action == 'insert':
|
|
649
|
+
return await client.insert_rule(
|
|
650
|
+
UUID(args.cluster), UUID(args.server), args.position,
|
|
651
|
+
object_type=args.object_type, infobase_name=args.infobase_name,
|
|
652
|
+
rule_type=args.rule_type, application_ext=args.application_ext,
|
|
653
|
+
priority=args.priority)
|
|
654
|
+
if args.action == 'info':
|
|
655
|
+
return await client.get_rule(UUID(args.cluster), UUID(args.server), UUID(args.rule))
|
|
656
|
+
return await client.list_rules(UUID(args.cluster), UUID(args.server))
|
|
657
|
+
if args.command in ('session', 'profile', 'counter', 'limit'):
|
|
658
|
+
if args.command == 'profile' and args.action == 'update':
|
|
659
|
+
return await client.update_profile(UUID(args.cluster), args.name, descr=args.descr,
|
|
660
|
+
config=None if args.config is None else args.config == 'yes',
|
|
661
|
+
priv=None if args.priv is None else args.priv == 'yes',
|
|
662
|
+
full_privileged_mode=None if args.full_privileged_mode is None else args.full_privileged_mode == 'yes',
|
|
663
|
+
crypto=None if args.crypto is None else args.crypto == 'yes',
|
|
664
|
+
right_extension=None if args.right_extension is None else args.right_extension == 'yes',
|
|
665
|
+
all_modules_extension=None if args.all_modules_extension is None else args.all_modules_extension == 'yes',
|
|
666
|
+
right_extension_definition_roles=args.right_extension_definition_roles,
|
|
667
|
+
privileged_mode_roles=args.privileged_mode_roles,
|
|
668
|
+
modules_available_for_extension=args.modules_available_for_extension,
|
|
669
|
+
modules_not_available_for_extension=args.modules_not_available_for_extension,
|
|
670
|
+
directory_access=None if args.directory_access is None else args.directory_access == 'full',
|
|
671
|
+
com_access=None if args.com_access is None else args.com_access == 'full',
|
|
672
|
+
addin_access=None if args.addin_access is None else args.addin_access == 'full',
|
|
673
|
+
module_access=None if args.module_access is None else args.module_access == 'full',
|
|
674
|
+
app_access=None if args.app_access is None else args.app_access == 'full',
|
|
675
|
+
inet_access=None if args.inet_access is None else args.inet_access == 'full')
|
|
676
|
+
if args.command == 'profile' and args.action == 'remove':
|
|
677
|
+
return await client.remove_profile(UUID(args.cluster), args.name)
|
|
678
|
+
if args.command == 'profile' and args.action == 'acl':
|
|
679
|
+
if args.acl_type == 'inet' and args.acl_action == 'update':
|
|
680
|
+
return await client.update_profile_inet(
|
|
681
|
+
UUID(args.cluster), args.name, args.item_name,
|
|
682
|
+
url=args.url, port=args.port, protocol=args.inet_protocol, descr=args.descr)
|
|
683
|
+
if args.acl_type == 'com' and args.acl_action == 'update':
|
|
684
|
+
return await client.update_profile_com_class(
|
|
685
|
+
UUID(args.cluster), args.name, args.item_name,
|
|
686
|
+
file_name=args.fileName, class_id=args.id, host=args.host, descr=args.descr)
|
|
687
|
+
if args.acl_type == 'module' and args.acl_action == 'update':
|
|
688
|
+
return await client.update_profile_module(UUID(args.cluster), args.name,
|
|
689
|
+
args.item_name, hash_value=args.hash, descr=args.descr)
|
|
690
|
+
if args.acl_type == 'addin' and args.acl_action == 'update':
|
|
691
|
+
return await client.update_profile_addin(UUID(args.cluster), args.name,
|
|
692
|
+
args.item_name, hash_value=args.hash, descr=args.descr)
|
|
693
|
+
if args.acl_type == 'app' and args.acl_action == 'update':
|
|
694
|
+
return await client.update_profile_app(UUID(args.cluster), args.name,
|
|
695
|
+
args.item_name, wild=args.wild, descr=args.descr)
|
|
696
|
+
if args.acl_type == 'directory' and args.acl_action == 'update':
|
|
697
|
+
return await client.update_profile_directory(
|
|
698
|
+
UUID(args.cluster), args.name, args.alias,
|
|
699
|
+
physical_path=args.physicalPath, descr=args.descr,
|
|
700
|
+
allowed_read=None if args.allowedRead is None else args.allowedRead == 'yes',
|
|
701
|
+
allowed_write=None if args.allowedWrite is None else args.allowedWrite == 'yes')
|
|
702
|
+
if args.acl_action == 'remove':
|
|
703
|
+
if args.acl_type == 'directory':
|
|
704
|
+
return await client.remove_profile_directory(UUID(args.cluster), args.name, args.alias)
|
|
705
|
+
method = {'app': client.remove_profile_app,
|
|
706
|
+
'module': client.remove_profile_module,
|
|
707
|
+
'addin': client.remove_profile_addin,
|
|
708
|
+
'inet': client.remove_profile_inet,
|
|
709
|
+
'com': client.remove_profile_com_class}[args.acl_type]
|
|
710
|
+
return await method(UUID(args.cluster), args.name, args.item_name)
|
|
711
|
+
method = {'directory': client.list_profile_directories,
|
|
712
|
+
'com': client.list_profile_com_classes,
|
|
713
|
+
'addin': client.list_profile_addins,
|
|
714
|
+
'module': client.list_profile_modules,
|
|
715
|
+
'app': client.list_profile_apps,
|
|
716
|
+
'inet': client.list_profile_inet}[args.acl_type]
|
|
717
|
+
return await method(UUID(args.cluster), args.name)
|
|
718
|
+
if args.command == 'session' and args.action == 'info':
|
|
719
|
+
return await client.get_session(UUID(args.cluster), UUID(args.session))
|
|
720
|
+
if args.command == 'session' and args.action == 'list':
|
|
721
|
+
return await client.list_sessions(UUID(args.cluster), UUID(args.infobase) if args.infobase else None)
|
|
722
|
+
if args.command == 'limit' and args.action == 'info':
|
|
723
|
+
return await client.get_limit(UUID(args.cluster), args.limit)
|
|
724
|
+
if args.command == 'limit' and args.action == 'remove':
|
|
725
|
+
return await client.remove_limit(UUID(args.cluster), args.name)
|
|
726
|
+
if args.command == 'limit' and args.action == 'update':
|
|
727
|
+
aliases = {'service': 'duration_service', 'call': 'calls',
|
|
728
|
+
'number_of_active_sessions': 'active_sessions',
|
|
729
|
+
'number_of_sessions': 'sessions'}
|
|
730
|
+
fields = ('duration', 'cpu_time', 'memory', 'read', 'write',
|
|
731
|
+
'duration_dbms', 'dbms_bytes', 'service', 'call',
|
|
732
|
+
'number_of_active_sessions', 'number_of_sessions')
|
|
733
|
+
return await client.update_limit(
|
|
734
|
+
UUID(args.cluster), args.name, action=args.limit_action,
|
|
735
|
+
counter=args.counter, error_message=args.error_message,
|
|
736
|
+
descr=args.descr,
|
|
737
|
+
**{aliases.get(key, key): getattr(args, key) for key in fields
|
|
738
|
+
if getattr(args, key) is not None})
|
|
739
|
+
if args.command == 'counter' and args.action != 'list':
|
|
740
|
+
if args.action == 'clear':
|
|
741
|
+
return await client.clear_counter(UUID(args.cluster), args.counter,
|
|
742
|
+
object_filter=args.object)
|
|
743
|
+
if args.action == 'remove':
|
|
744
|
+
return await client.remove_counter(UUID(args.cluster), args.name)
|
|
745
|
+
if args.action == 'update':
|
|
746
|
+
flags = ('duration', 'cpu_time', 'memory', 'read', 'write',
|
|
747
|
+
'duration_dbms', 'dbms_bytes', 'service', 'call',
|
|
748
|
+
'number_of_active_sessions', 'number_of_sessions')
|
|
749
|
+
return await client.update_counter(
|
|
750
|
+
UUID(args.cluster), args.name, collection_time=args.collection_time,
|
|
751
|
+
group=args.group, filter_type=args.filter_type, filter=args.filter,
|
|
752
|
+
descr=args.descr, **{key: getattr(args, key) == 'analyze' for key in flags
|
|
753
|
+
if getattr(args, key) is not None})
|
|
754
|
+
if args.action == 'info':
|
|
755
|
+
return await client.get_counter(UUID(args.cluster), args.counter)
|
|
756
|
+
if args.action == 'values':
|
|
757
|
+
return await client.list_counter_values(UUID(args.cluster), args.counter, args.object)
|
|
758
|
+
return await client.list_accumulated_counter_values(UUID(args.cluster), args.counter, args.object)
|
|
759
|
+
return await getattr(client, 'list_' + args.command + 's')(UUID(args.cluster))
|
|
760
|
+
if args.command == 'cluster':
|
|
761
|
+
if args.action == 'remove':
|
|
762
|
+
return await client.remove_cluster(UUID(args.cluster))
|
|
763
|
+
if args.action == 'insert':
|
|
764
|
+
options = {key: getattr(args, key) for key in (
|
|
765
|
+
'expiration_timeout', 'security_level', 'session_fault_tolerance_level',
|
|
766
|
+
'load_balancing_mode', 'restart_schedule', 'ping_period', 'ping_timeout')
|
|
767
|
+
if getattr(args, key) is not None}
|
|
768
|
+
for key in ('kill_problem_processes', 'kill_by_memory_with_dump'):
|
|
769
|
+
if getattr(args, key) is not None:
|
|
770
|
+
options[key] = getattr(args, key) == 'yes'
|
|
771
|
+
if args.allow_access_right_audit_events_recording is not None:
|
|
772
|
+
options['audit'] = args.allow_access_right_audit_events_recording == 'yes'
|
|
773
|
+
return await client.insert_cluster(args.host, args.port, args.name, **options)
|
|
774
|
+
if args.action == 'update' and args.ping_period is not None:
|
|
775
|
+
return await client.update_cluster_ping(UUID(args.cluster), args.ping_period, args.ping_timeout)
|
|
776
|
+
if args.action == 'admin':
|
|
777
|
+
if args.detail == 'register':
|
|
778
|
+
return await client.register_cluster_admin(
|
|
779
|
+
UUID(args.cluster), args.name, args.os_user, descr=args.descr)
|
|
780
|
+
if args.detail == 'remove':
|
|
781
|
+
return await client.remove_cluster_admin(UUID(args.cluster), args.name)
|
|
782
|
+
return await client.list_cluster_admins(UUID(args.cluster))
|
|
783
|
+
if args.action == 'list':
|
|
784
|
+
return await client.list_clusters()
|
|
785
|
+
if args.action == 'info':
|
|
786
|
+
return await client.get_cluster(UUID(args.cluster))
|
|
787
|
+
if args.name is not None:
|
|
788
|
+
return await client.update_cluster_name(UUID(args.cluster), args.name)
|
|
789
|
+
if args.expiration_timeout is not None:
|
|
790
|
+
return await client.update_cluster_expiration_timeout(UUID(args.cluster), args.expiration_timeout)
|
|
791
|
+
if args.security_level is not None:
|
|
792
|
+
return await client.update_cluster_security_level(UUID(args.cluster), args.security_level)
|
|
793
|
+
if args.session_fault_tolerance_level is not None:
|
|
794
|
+
return await client.update_cluster_session_fault_tolerance_level(
|
|
795
|
+
UUID(args.cluster), args.session_fault_tolerance_level)
|
|
796
|
+
if args.load_balancing_mode is not None:
|
|
797
|
+
return await client.update_cluster_load_balancing_mode(
|
|
798
|
+
UUID(args.cluster), args.load_balancing_mode)
|
|
799
|
+
if args.kill_problem_processes is not None:
|
|
800
|
+
return await client.update_cluster_kill_problem_processes(
|
|
801
|
+
UUID(args.cluster), args.kill_problem_processes == 'yes')
|
|
802
|
+
if args.kill_by_memory_with_dump is not None:
|
|
803
|
+
return await client.update_cluster_kill_by_memory_with_dump(
|
|
804
|
+
UUID(args.cluster), args.kill_by_memory_with_dump == 'yes')
|
|
805
|
+
if args.allow_access_right_audit_events_recording is not None:
|
|
806
|
+
return await client.update_cluster_audit(
|
|
807
|
+
UUID(args.cluster), args.allow_access_right_audit_events_recording == 'yes')
|
|
808
|
+
return await client.update_restart_schedule(UUID(args.cluster), args.restart_schedule)
|
|
809
|
+
cluster = UUID(args.cluster)
|
|
810
|
+
if args.command == 'server':
|
|
811
|
+
if args.action == 'info':
|
|
812
|
+
return await client.get_server(cluster, UUID(args.server))
|
|
813
|
+
if args.action == 'update':
|
|
814
|
+
if args.port_ranges is not None:
|
|
815
|
+
return await client.update_server_port_ranges(cluster, UUID(args.server), ranges)
|
|
816
|
+
if args.dedicate_managers is not None:
|
|
817
|
+
return await client.update_server_dedicate_managers(
|
|
818
|
+
cluster, UUID(args.server), args.dedicate_managers)
|
|
819
|
+
if args.temporary_allowed_total_memory_time_limit is not None:
|
|
820
|
+
return await client.update_server_temporary_allowed_total_memory_time_limit(
|
|
821
|
+
cluster, UUID(args.server), args.temporary_allowed_total_memory_time_limit)
|
|
822
|
+
if args.temporary_allowed_total_memory is not None:
|
|
823
|
+
return await client.update_server_temporary_allowed_total_memory(
|
|
824
|
+
cluster, UUID(args.server), args.temporary_allowed_total_memory)
|
|
825
|
+
if args.critical_total_memory is not None:
|
|
826
|
+
return await client.update_server_critical_total_memory(
|
|
827
|
+
cluster, UUID(args.server), args.critical_total_memory)
|
|
828
|
+
if args.service_principal_name is not None:
|
|
829
|
+
return await client.update_server_service_principal_name(
|
|
830
|
+
cluster, UUID(args.server), args.service_principal_name)
|
|
831
|
+
if args.safe_call_memory_limit is not None:
|
|
832
|
+
return await client.update_server_safe_call_memory_limit(
|
|
833
|
+
cluster, UUID(args.server), args.safe_call_memory_limit)
|
|
834
|
+
if args.connections_limit is not None:
|
|
835
|
+
return await client.update_server_connections_limit(cluster, UUID(args.server),
|
|
836
|
+
args.connections_limit)
|
|
837
|
+
if args.infobases_limit is not None:
|
|
838
|
+
return await client.update_server_infobases_limit(cluster, UUID(args.server),
|
|
839
|
+
args.infobases_limit)
|
|
840
|
+
return await client.update_server_restart_schedule(cluster, UUID(args.server), args.restart_schedule)
|
|
841
|
+
return await client.list_servers(cluster)
|
|
842
|
+
if args.command == 'process':
|
|
843
|
+
if args.action == 'info':
|
|
844
|
+
return await client.get_process(cluster, UUID(args.process))
|
|
845
|
+
if args.action == 'turn-off':
|
|
846
|
+
return await client.turn_off_process(cluster, UUID(args.process))
|
|
847
|
+
return await client.list_processes(cluster, UUID(args.server) if args.server else None)
|
|
848
|
+
if args.command == 'binary-data-storage':
|
|
849
|
+
return await client.list_binary_storages(cluster, UUID(args.infobase))
|
|
850
|
+
if args.command == 'infobase' and args.action == 'update':
|
|
851
|
+
if args.safe_mode_security_profile_name is not None:
|
|
852
|
+
return await client.update_infobase_safe_mode_security_profile(
|
|
853
|
+
cluster, UUID(args.infobase), args.safe_mode_security_profile_name)
|
|
854
|
+
if args.security_profile_name is not None:
|
|
855
|
+
return await client.update_infobase_security_profile(
|
|
856
|
+
cluster, UUID(args.infobase), args.security_profile_name)
|
|
857
|
+
if args.maximum_scheduled_jobs_start_shift_without_active_users is not None:
|
|
858
|
+
return await client.update_infobase_maximum_scheduled_jobs_start_shift(
|
|
859
|
+
cluster, UUID(args.infobase),
|
|
860
|
+
args.maximum_scheduled_jobs_start_shift_without_active_users)
|
|
861
|
+
if args.minimum_scheduled_jobs_start_period_without_active_users is not None:
|
|
862
|
+
return await client.update_infobase_minimum_scheduled_jobs_start_period(
|
|
863
|
+
cluster, UUID(args.infobase),
|
|
864
|
+
args.minimum_scheduled_jobs_start_period_without_active_users)
|
|
865
|
+
if args.configuration_unload_delay_by_working_process_without_active_users is not None:
|
|
866
|
+
return await client.update_infobase_configuration_unload_delay(
|
|
867
|
+
cluster, UUID(args.infobase),
|
|
868
|
+
args.configuration_unload_delay_by_working_process_without_active_users)
|
|
869
|
+
if args.disable_local_speech_to_text is not None:
|
|
870
|
+
return await client.update_infobase_disable_local_speech_to_text(
|
|
871
|
+
cluster, UUID(args.infobase), args.disable_local_speech_to_text == 'yes')
|
|
872
|
+
if args.external_session_manager_required is not None:
|
|
873
|
+
return await client.update_infobase_external_session_manager_required(
|
|
874
|
+
cluster, UUID(args.infobase), args.external_session_manager_required == 'yes')
|
|
875
|
+
if args.reserve_working_processes is not None:
|
|
876
|
+
return await client.update_infobase_reserve_working_processes(
|
|
877
|
+
cluster, UUID(args.infobase), args.reserve_working_processes == 'yes')
|
|
878
|
+
if args.denied_message is not None:
|
|
879
|
+
return await client.update_infobase_denied_message(
|
|
880
|
+
cluster, UUID(args.infobase), args.denied_message)
|
|
881
|
+
if args.license_distribution is not None:
|
|
882
|
+
return await client.update_infobase_license_distribution(
|
|
883
|
+
cluster, UUID(args.infobase), args.license_distribution)
|
|
884
|
+
if args.sessions_deny is not None:
|
|
885
|
+
return await client.update_infobase_sessions_deny(
|
|
886
|
+
cluster, UUID(args.infobase), args.sessions_deny == 'on')
|
|
887
|
+
if args.scheduled_jobs_deny is not None:
|
|
888
|
+
return await client.update_infobase_scheduled_jobs_deny(
|
|
889
|
+
cluster, UUID(args.infobase), args.scheduled_jobs_deny == 'on')
|
|
890
|
+
return await client.update_infobase_description(
|
|
891
|
+
cluster, UUID(args.infobase), args.descr)
|
|
892
|
+
if args.command == 'infobase' and args.action == 'create':
|
|
893
|
+
return await client.create_infobase(cluster, name=args.name,
|
|
894
|
+
db_name=args.db_name, db_server=args.db_server, db_user=args.db_user,
|
|
895
|
+
locale=args.locale, create_database=args.create_database, descr=args.descr,
|
|
896
|
+
scheduled_jobs_denied=args.scheduled_jobs_deny == 'on',
|
|
897
|
+
license_distribution=args.license_distribution, date_offset=args.date_offset,
|
|
898
|
+
security_level=args.security_level)
|
|
899
|
+
if args.command == 'infobase' and args.action == 'drop':
|
|
900
|
+
return await client.drop_infobase(cluster, UUID(args.infobase),
|
|
901
|
+
drop_database=args.drop_database,
|
|
902
|
+
clear_database=args.clear_database)
|
|
903
|
+
if args.command == 'infobase' and args.action == 'info':
|
|
904
|
+
return await client.get_infobase_info(
|
|
905
|
+
cluster, UUID(args.infobase) if args.infobase else None, name=args.name)
|
|
906
|
+
if args.command == 'infobase' and args.detail == 'update':
|
|
907
|
+
return await client.update_infobase_summary_description(
|
|
908
|
+
cluster, UUID(args.infobase), args.descr)
|
|
909
|
+
if args.command == 'infobase' and args.detail == 'info':
|
|
910
|
+
return await client.get_infobase_summary(
|
|
911
|
+
cluster, UUID(args.infobase) if args.infobase else None, name=args.name)
|
|
912
|
+
return await client.list_infobases(cluster)
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
def main(argv=None):
|
|
916
|
+
args = build_parser().parse_args(argv)
|
|
917
|
+
try:
|
|
918
|
+
pprint(asyncio.run(run(args)))
|
|
919
|
+
except (RacError, ValueError) as exc:
|
|
920
|
+
# Errors from native rac are deliberately not echoed; may include credentials.
|
|
921
|
+
build_parser().exit(1, 'RAC request failed: ' + str(exc) + '\n')
|