@@ -134,27 +134,32 @@ func main() {
134
134
active := false
135
135
callbacks := & ha.Callbacks {
136
136
OnActive : func (status * util.HighAvailability ) {
137
+ stateSync := status .Group .Local .StateSync
138
+ syncEnabled := status .Group .RunningSyncEnabled
139
+ runningSync := status .Group .RunningSync
137
140
switch {
138
- case status .Group .Local .StateSync == "Complete" :
139
- if status .Group .RunningSyncEnabled == "yes" && status .Group .RunningSync == "synchronized" {
140
- glog .V (3 ).Infof ("PAN firewall on active, and synchronized." )
141
- if ! active {
142
- if err := op .Run (ctx ); err != nil {
143
- glog .Fatalf ("Error to run the operator: %s." , err )
144
- }
145
- active = true
141
+ case stateSync == "Complete" && syncEnabled == "yes" && runningSync == "synchronized" :
142
+ glog .V (3 ).Infof ("PAN firewall on active, and synchronized." )
143
+ if ! active {
144
+ if err := op .Run (ctx ); err != nil {
145
+ glog .Fatalf ("Error to run the operator: %s." , err )
146
146
}
147
+ active = true
147
148
}
148
149
default :
149
150
glog .V (3 ).Infof ("PAN firewall on active, but not synchronized." )
151
+ if active {
152
+ op .Stop ()
153
+ glog .Fatalf ("The active state lost and not synchronized, exiting..." )
154
+ }
150
155
}
151
156
},
152
157
OnPassive : func () {
153
158
glog .V (3 ).Infof ("PAN firewall on passive." )
154
159
if active {
155
160
op .Stop ()
156
161
active = false
157
- glog .Fatalf ("Active state lost, exiting..." )
162
+ glog .Fatalf ("The active state lost, exiting..." )
158
163
}
159
164
},
160
165
OnFail : func (err error ) {
0 commit comments