pi 0.1.31 → 0.1.32
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.
- data/lib/cli/commands/apps.rb +36 -24
- data/lib/cli/commands/services.rb +15 -14
- data/lib/cli/runner.rb +5 -5
- data/lib/cli/usage.rb +1 -3
- data/lib/cli/version.rb +1 -1
- data/lib/pi/client.rb +4 -4
- metadata +4 -4
data/lib/cli/commands/apps.rb
CHANGED
@@ -11,7 +11,8 @@ module PI::Cli::Command
|
|
11
11
|
"graceful" => true,
|
12
12
|
"lazy" => true,
|
13
13
|
"isDebug" => false,
|
14
|
-
"needMonitor" => false
|
14
|
+
"needMonitor" => false,
|
15
|
+
"probe" => false
|
15
16
|
}
|
16
17
|
|
17
18
|
def apps
|
@@ -174,8 +175,11 @@ module PI::Cli::Command
|
|
174
175
|
isDebug = (isDebug == false ? "no" : "yes")
|
175
176
|
choices = ["restart", "notify"]
|
176
177
|
action_for_change = ask"Reaction when service changed", :default => DEFAULTS["action_for_change"], :choices => choices, :indexed => true
|
177
|
-
|
178
|
-
|
178
|
+
probe = false
|
179
|
+
probe = ask "Need JMX monitoring?", :default => DEFAULTS["probe"] if deployType == "binary"
|
180
|
+
probe = (probe == false ? "no" : "yes")
|
181
|
+
# needMonitor = ask "Need monitor?", :default => DEFAULTS["needMonitor"]
|
182
|
+
# needMonitor = (needMonitor == false ? "no" : "yes")
|
179
183
|
|
180
184
|
manifest = {
|
181
185
|
:targetName => target,
|
@@ -190,7 +194,8 @@ module PI::Cli::Command
|
|
190
194
|
:tag => tag,
|
191
195
|
:isDebug => isDebug,
|
192
196
|
:action_for_change => action_for_change,
|
193
|
-
:needMonitor =>
|
197
|
+
:needMonitor => "no",
|
198
|
+
:probe => probe
|
194
199
|
}
|
195
200
|
|
196
201
|
display "Creating application \"#{appname}\": ",false
|
@@ -541,26 +546,33 @@ module PI::Cli::Command
|
|
541
546
|
display logs[1]
|
542
547
|
end
|
543
548
|
|
544
|
-
def app_debug(appid_or_appname=nil)
|
545
|
-
all_opts = total_opts
|
546
|
-
all_opts_except_valid_opts = all_opts.delete_if{ |key,value| key.to_s =~ /(target)/i}
|
547
|
-
all_opts_except_valid_opts.each_value do |value|
|
548
|
-
err "Invalid options" if value != nil
|
549
|
-
end
|
550
|
-
client.check_login_status
|
551
|
-
app, appid = choose_app_help_target_not_all(appid_or_appname)
|
552
|
-
appid = (appid == nil ? app[:id] : appid)
|
553
|
-
debug_info = client.app_debug_info(appid)
|
554
|
-
return display JSON.pretty_generate(debug_info) if @options[:json]
|
555
|
-
return display "No debug info" if debug_info.nil? || debug_info.empty?
|
556
|
-
debug_table = table do |t|
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
549
|
+
# def app_debug(appid_or_appname=nil)
|
550
|
+
# all_opts = total_opts
|
551
|
+
# all_opts_except_valid_opts = all_opts.delete_if{ |key,value| key.to_s =~ /(target)/i}
|
552
|
+
# all_opts_except_valid_opts.each_value do |value|
|
553
|
+
# err "Invalid options" if value != nil
|
554
|
+
# end
|
555
|
+
# client.check_login_status
|
556
|
+
# app, appid = choose_app_help_target_not_all(appid_or_appname)
|
557
|
+
# appid = (appid == nil ? app[:id] : appid)
|
558
|
+
# debug_info = client.app_debug_info(appid)
|
559
|
+
# return display JSON.pretty_generate(debug_info) if @options[:json]
|
560
|
+
# return display "No debug info" if debug_info.nil? || debug_info.empty?
|
561
|
+
# debug_table = table do |t|
|
562
|
+
# if app[:deployType] == "binary"
|
563
|
+
# t.headings = 'Index', 'Debug IP', 'Debug Port', 'State', 'Probe URL'
|
564
|
+
# debug_info.each do |d|
|
565
|
+
# t << [d[:index], d[:debug_ip], d[:debug_port], d[:state], d[:probe_url]]
|
566
|
+
# end
|
567
|
+
# else
|
568
|
+
# t.headings = 'Index', 'Debug IP', 'Debug Port', 'State'
|
569
|
+
# debug_info.each do |d|
|
570
|
+
# t << [d[:index], d[:debug_ip], d[:debug_port], d[:state]]
|
571
|
+
# end
|
572
|
+
# end
|
573
|
+
# end
|
574
|
+
# display debug_table
|
575
|
+
# end
|
564
576
|
|
565
577
|
private
|
566
578
|
|
@@ -196,10 +196,10 @@ module PI::Cli::Command
|
|
196
196
|
end
|
197
197
|
client.check_login_status
|
198
198
|
target = @options[:target]
|
199
|
-
servicetype = @options[:type]
|
200
|
-
if servicetype
|
201
|
-
err "Invalid type. Please use --type 1 or --type 2" unless servicetype =~ /[1|2]/
|
202
|
-
end
|
199
|
+
# servicetype = @options[:type]
|
200
|
+
# if servicetype
|
201
|
+
# err "Invalid type. Please use --type 1 or --type 2" unless servicetype =~ /[1|2]/
|
202
|
+
# end
|
203
203
|
if serviceid
|
204
204
|
services = client.services
|
205
205
|
err "No services" if services.nil? || services.empty?
|
@@ -222,16 +222,17 @@ module PI::Cli::Command
|
|
222
222
|
else
|
223
223
|
target = ask"Select target", :choices => targets.collect { |t| t[:name] }, :indexed => true
|
224
224
|
end
|
225
|
-
unless servicetype
|
226
|
-
choices = ["App Service", "Session Service"]
|
227
|
-
servicetype = ask"Select service type", :choices => choices, :indexed => true
|
228
|
-
if servicetype == "App Service"
|
229
|
-
servicetype = 1
|
230
|
-
else
|
231
|
-
servicetype = 2
|
232
|
-
end
|
233
|
-
end
|
234
|
-
client.register_service(serviceid, target, servicetype)
|
225
|
+
# unless servicetype
|
226
|
+
# choices = ["App Service", "Session Service"]
|
227
|
+
# servicetype = ask"Select service type", :choices => choices, :indexed => true
|
228
|
+
# if servicetype == "App Service"
|
229
|
+
# servicetype = 1
|
230
|
+
# else
|
231
|
+
# servicetype = 2
|
232
|
+
# end
|
233
|
+
# end
|
234
|
+
# client.register_service(serviceid, target, servicetype)
|
235
|
+
client.register_service(serviceid, target)
|
235
236
|
display "OK".green
|
236
237
|
end
|
237
238
|
|
data/lib/cli/runner.rb
CHANGED
@@ -36,7 +36,7 @@ class PI::Cli::Runner
|
|
36
36
|
opts.on('--projectid ID') { |id| @options[:projectid] = id }
|
37
37
|
opts.on('--target TARG') { |targ| @options[:target] = targ }
|
38
38
|
opts.on('--instance N', Integer) { |inst| @options[:instance] = inst }
|
39
|
-
opts.on('--type TYPE') { |type| @options[:type] = type }
|
39
|
+
# opts.on('--type TYPE') { |type| @options[:type] = type }
|
40
40
|
opts.on('--value VALUE') { |value| @options[:value] = value }
|
41
41
|
opts.on('--service SERVICE') { |service| @options[:service] = service }
|
42
42
|
opts.on('--dns DNS') { |dns| @options[:dns] = dns }
|
@@ -270,9 +270,9 @@ class PI::Cli::Runner
|
|
270
270
|
usage('pi app-log [appid] [--instanceid,--file] or pi app-log <appname> <--target TARGET> [--instanceid,--file]')
|
271
271
|
set_cmd(:apps, :app_log, @args.size == 1 ? 1 : 0)
|
272
272
|
|
273
|
-
when 'app-debug'
|
274
|
-
usage('pi app-debug [appid] or pi app-log <appname> <--target TARGET>')
|
275
|
-
set_cmd(:apps, :app_debug, @args.size == 1 ? 1 : 0)
|
273
|
+
# when 'app-debug'
|
274
|
+
# usage('pi app-debug [appid] or pi app-log <appname> <--target TARGET>')
|
275
|
+
# set_cmd(:apps, :app_debug, @args.size == 1 ? 1 : 0)
|
276
276
|
|
277
277
|
###############################################################################
|
278
278
|
# Services
|
@@ -311,7 +311,7 @@ class PI::Cli::Runner
|
|
311
311
|
set_cmd(:services, :check_service, @args.size == 1 ? 1 : 0)
|
312
312
|
|
313
313
|
when 'register-service'
|
314
|
-
usage('pi register-service [serviceid] [--target TARGET]
|
314
|
+
usage('pi register-service [serviceid] [--target TARGET]')
|
315
315
|
set_cmd(:services, :register_service, @args.size == 1 ? 1 : 0)
|
316
316
|
|
317
317
|
when 'deregister-service'
|
data/lib/cli/usage.rb
CHANGED
@@ -75,8 +75,6 @@ Currently available pi commands are:
|
|
75
75
|
delete-env <appname> <--target TARGET> [--name NAME] Delete the environment for the application
|
76
76
|
app-log [appid] [--instanceid,--file] List the logs for the application
|
77
77
|
app-log <appname> <--target TARGET> [--instanceid,--file] List the logs for the application
|
78
|
-
app-debug [appid] List the debug info for the application
|
79
|
-
app-debug <appname> <--target TARGET> List the debug info for the application
|
80
78
|
|
81
79
|
Service
|
82
80
|
app-service [appid] Display the binded services for the application
|
@@ -91,7 +89,7 @@ Currently available pi commands are:
|
|
91
89
|
import-service [url] Import dedicated service
|
92
90
|
check-service [serviceid] Check availability for the service
|
93
91
|
delete-service [serviceid] Delete the service
|
94
|
-
register-service [serviceid] [--target
|
92
|
+
register-service [serviceid] [--target TARGET] Register to target
|
95
93
|
deregister-service [serviceid] [--target TARGET] Deregister to target
|
96
94
|
|
97
95
|
DNS
|
data/lib/cli/version.rb
CHANGED
data/lib/pi/client.rb
CHANGED
@@ -285,7 +285,7 @@ class PI::Client
|
|
285
285
|
|
286
286
|
def app_debug_info(appid)
|
287
287
|
appid = uri_encode(appid)
|
288
|
-
json_get("#{PI::APP_PATH}/#{appid}/
|
288
|
+
json_get("#{PI::APP_PATH}/#{appid}/instances")
|
289
289
|
end
|
290
290
|
|
291
291
|
#####################################################
|
@@ -351,11 +351,11 @@ class PI::Client
|
|
351
351
|
json_get("#{PI::SERVICE_PATH}/servicetarget/#{serviceid}")
|
352
352
|
end
|
353
353
|
|
354
|
-
def register_service(serviceid, targetname,
|
354
|
+
def register_service(serviceid, targetname, manifest={})
|
355
355
|
serviceid = uri_encode(serviceid)
|
356
356
|
targetname = uri_encode(targetname)
|
357
|
-
servicetype = uri_encode(servicetype)
|
358
|
-
json_post("#{PI::SERVICE_PATH}/register/#{targetname}/#{serviceid}?serviceType
|
357
|
+
# servicetype = uri_encode(servicetype)
|
358
|
+
json_post("#{PI::SERVICE_PATH}/register/#{targetname}/#{serviceid}?serviceType=1",manifest)
|
359
359
|
end
|
360
360
|
|
361
361
|
def deregister_service(servicetargetid)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 91
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 32
|
10
|
+
version: 0.1.32
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Samsung
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-10-13 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json_pure
|