@@ -30,10 +30,18 @@ function RegisterNewNode {
30
30
$AUTH_KEY ,
31
31
$NODE_NAME ,
32
32
$ENABLE_HA ,
33
- $HA_PORT
33
+ $HA_PORT ,
34
+ $ENABLE_AD ,
35
+ $AD_TIME
34
36
)
35
37
36
38
Write-Log " Start registering a new SHIR node"
39
+ Write-Log " Registering SHIR node with the node key: $ ( $AUTH_KEY ) "
40
+
41
+ if (! $NODE_NAME ) {
42
+ $NODE_NAME = $Env: COMPUTERNAME
43
+ }
44
+ Write-Log " Registering SHIR node with the node name: $ ( $NODE_NAME ) "
37
45
38
46
if ($ENABLE_HA -eq " true" ) {
39
47
Write-Log " Enable High Availability"
@@ -46,8 +54,15 @@ function RegisterNewNode {
46
54
Start-Sleep - Seconds 15
47
55
}
48
56
49
- if (! $NODE_NAME ) {
50
- Start-Process $DmgcmdPath - Wait - ArgumentList " -RegisterNewNode" , " $ ( $AUTH_KEY ) " - RedirectStandardOutput " C:\SHIR\register-out.txt" - RedirectStandardError " C:\SHIR\register-error.txt"
57
+ if ($ENABLE_AD -eq " true" ) {
58
+ Write-Log " Enable Expired Nodes Auto-Deletion"
59
+ if (! $AD_TIME ) {
60
+ $AD_TIME = 600
61
+ }
62
+
63
+ Write-Log " Node Expiration Time In Seconds: $ ( $AD_TIME ) "
64
+ Start-Process $DmgcmdPath - Wait - ArgumentList " -RegisterNewNode" , " $ ( $AUTH_KEY ) " , " $ ( $NODE_NAME ) " , " $ ( $AD_TIME ) " - RedirectStandardOutput " C:\SHIR\register-out.txt" - RedirectStandardError " C:\SHIR\register-error.txt"
65
+ Start-Sleep - Seconds 15
51
66
} else {
52
67
Start-Process $DmgcmdPath - Wait - ArgumentList " -RegisterNewNode" , " $ ( $AUTH_KEY ) " , " $ ( $NODE_NAME ) " - RedirectStandardOutput " C:\SHIR\register-out.txt" - RedirectStandardError " C:\SHIR\register-error.txt"
53
68
}
@@ -85,14 +100,9 @@ if (Check-Is-Registered) {
85
100
86
101
Start-Process $DmgcmdPath - Wait - ArgumentList " -Start"
87
102
} elseif (Test-Path Env:AUTH_KEY) {
88
- Write-Log " Registering SHIR node with the node key: $ ( $Env: AUTH_KEY ) "
89
- Write-Log " Registering SHIR node with the node name: $ ( $Env: NODE_NAME ) "
90
- Write-Log " Registering SHIR node with the enable high availability flag: $ ( $Env: ENABLE_HA ) "
91
- Write-Log " Registering SHIR node with the tcp port: $ ( $Env: HA_PORT ) "
92
-
93
103
Start-Process $DmgcmdPath - Wait - ArgumentList " -Start"
94
104
95
- RegisterNewNode $Env: AUTH_KEY $Env: NODE_NAME $Env: ENABLE_HA $Env: HA_PORT
105
+ RegisterNewNode $Env: AUTH_KEY $Env: NODE_NAME $Env: ENABLE_HA $Env: HA_PORT $ Env: ENABLE_AD $ Env: AD_TIME
96
106
} else {
97
107
Write-Log " Invalid AUTH_KEY Value"
98
108
exit 1
0 commit comments