phoseum-cli 0.0.18 → 0.0.19
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/phoseum-cli +15 -8
- data/lib/phoseum/phoseum-cli-lib.rb +30 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '092592a7b73a29fb773b199b9e29f7054da0da5701583c1162c2500a1860635f'
|
4
|
+
data.tar.gz: fc71817a9eb49a14d2567694efaa91ee076e991a1780b8abdbf20b3a2c2032db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78a80cda0d947299a0b95b86f2ccebcf1df4d263bdad641ff0d0aec8d3e2445a28d2062ba52f49d520bf334051448adcf02674069992f7b55d22e1eb60e9f288
|
7
|
+
data.tar.gz: 2b296a8c6ab2f30de4e7c85dd0b9acf55a3c5b8130ed9887c359220da14879d2b73895894b29f450c4b4a390f04edae6473fe317874183284d336066ddaac3cb
|
data/bin/phoseum-cli
CHANGED
@@ -341,7 +341,6 @@ def user_login(puser='',ppass='')
|
|
341
341
|
return false
|
342
342
|
end
|
343
343
|
|
344
|
-
|
345
344
|
def delete(what='',path='')
|
346
345
|
if !validate_token($config['TOKEN'])
|
347
346
|
if token = user_login()
|
@@ -461,15 +460,23 @@ case options
|
|
461
460
|
end
|
462
461
|
when -> (o) { o[:options] }
|
463
462
|
if options[:user]
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
print "\n Change [P]assword, [U]sername, [R]ole :[P/U/R]: "
|
468
|
-
confirm=STDIN.gets.chomp
|
469
|
-
else
|
470
|
-
puts "User Check Failed".red
|
463
|
+
tokeninfo = api_caller({"action" => "token-payload", "token" => "#{$config['TOKEN']}"})
|
464
|
+
if tokeninfo['error']
|
465
|
+
puts "Your token seems invalid, please login again".red
|
471
466
|
exit 1
|
472
467
|
end
|
468
|
+
if tokeninfo['success']
|
469
|
+
puts tokeninfo.payload
|
470
|
+
end
|
471
|
+
# print "Please confirm #{options[:user]} password.\n\t"
|
472
|
+
# current_password=STDIN.getpass('Password: ')
|
473
|
+
# if token = user_login(options[:user],current_password)
|
474
|
+
# print "\n Change [P]assword, [U]sername, [R]ole :[P/U/R]: "
|
475
|
+
# confirm=STDIN.gets.chomp
|
476
|
+
# else
|
477
|
+
# puts "User Check Failed".red
|
478
|
+
# exit 1
|
479
|
+
# end
|
473
480
|
else
|
474
481
|
# if !what
|
475
482
|
puts "Got no user to work with. Exiting.".red
|
@@ -261,6 +261,35 @@ def validate_token(token)
|
|
261
261
|
end
|
262
262
|
end
|
263
263
|
|
264
|
+
def api_caller(json_body)
|
265
|
+
headers = {}
|
266
|
+
if $config['TOKEN']
|
267
|
+
headers={ "bearer" => "#{$config['TOKEN']}" }
|
268
|
+
else
|
269
|
+
return false
|
270
|
+
end
|
271
|
+
base = URI.parse("#{$config['SERVERURL']}")
|
272
|
+
request = Net::HTTP::Post.new(base,headers)
|
273
|
+
request.body = JSON.generate(json_body)
|
274
|
+
response = Net::HTTP.start(base.hostname, $config['PORT'],
|
275
|
+
:timeout => $config['CALL_TIMEOUT'],
|
276
|
+
:use_ssl => base.scheme == "https",
|
277
|
+
:verify_mode => OpenSSL::SSL::VERIFY_PEER,
|
278
|
+
:ca_file => $config['CA_TRUST']
|
279
|
+
) do |http|
|
280
|
+
http.request(request)
|
281
|
+
end
|
282
|
+
begin
|
283
|
+
list = JSON.parse(response.body)
|
284
|
+
return list
|
285
|
+
rescue
|
286
|
+
puts "\nThe server sent out an Error:".red
|
287
|
+
puts clean_html(response.body)
|
288
|
+
exit 1
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
|
264
293
|
def cross_versions
|
265
294
|
headers = {}
|
266
295
|
base = URI.parse("#{$config['SERVERURL']}")
|
@@ -291,7 +320,6 @@ def cross_versions
|
|
291
320
|
end
|
292
321
|
end
|
293
322
|
|
294
|
-
|
295
323
|
def delete_user(username)
|
296
324
|
headers = {}
|
297
325
|
if $config['TOKEN']
|
@@ -330,4 +358,4 @@ def local_version
|
|
330
358
|
return
|
331
359
|
end
|
332
360
|
|
333
|
-
VERSION_SIGN="0.0.
|
361
|
+
VERSION_SIGN="0.0.19"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phoseum-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julio C Hegedus
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yaml
|