This repository has been archived by the owner on Mar 9, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
postdeploy_final.icall
71 lines (60 loc) · 2.11 KB
/
postdeploy_final.icall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
sys icall script %APP_PATH%/postdeploy_final {
app-service %APP_PATH%/%APP_NAME%
definition {
set app %APP_NAME%
set app_path %APP_PATH%
set partition %PARTITION%
set vs_name %VS_NAME%
set newdeploy %NEWDEPLOY%
set redeploy %REDEPLOY%
set strict_updates %STRICTUPDATES%
set aso "/$partition/${app}.app/$app"
set iaso [format "sys.application.service %s" $aso]
set logprefix "\[appsvcs_postdeploy_final\]\[$app\]"
set systemTime [clock seconds]
puts "$logprefix Starting at [clock format $systemTime -format %D] [clock format $systemTime -format %H:%M:%S]"
tmsh::cd $app_path
puts "$logprefix Setting iCall handler to inactive..."
tmsh::modify sys application service $aso strict-updates disabled
tmsh::modify sys icall handler periodic postdeploy_final status inactive
istats::set [format "%s string deploy.postdeploy_final" $iaso] "STARTED"
istats::set [format "%s string deploy.postdeploy_final" $iaso] "DEFERRED_CMDS_IN_PROGRESS"
puts "$logprefix Executing deferred commands..."
%DEFERREDCMDS%
puts "$logprefix Completed executing deferred commands..."
istats::set [format "%s string deploy.postdeploy_final" $iaso] "DEFERRED_CMDS_COMPLETE"
tmsh::delete sys icall handler periodic postdeploy_final
if { $strict_updates eq "enabled" } {
tmsh::modify sys application service $aso strict-updates enabled
}
#tmsh::save sys config
set systemTime [clock seconds]
puts "$logprefix Finished at [clock format $systemTime -format %D] [clock format $systemTime -format %H:%M:%S]"
istats::set [format "%s string deploy.postdeploy_final" $iaso] [format "FINISHED_%s" $systemTime]
}
description none
events none
}
sys icall handler periodic %APP_PATH%/postdeploy_final {
app-service %APP_PATH%/%APP_NAME%
first-occurrence %ICALLTIME%
interval 3000
last-occurrence now+10m
script %APP_PATH%/postdeploy_final
status %HANDLER_STATE%
}
cli script /Common/appsvcs_get_istat {
proc script::init {} {
}
proc script::run {} {
if { $tmsh::argc < 2 } {
puts "Please specify a iStat key to get"
exit
}
puts [istats::get [lindex $tmsh::argv 1]]
}
proc script::help {} {
}
proc script::tabc {} {
}
}