Skip to content

Commit

Permalink
Merge pull request #4075 from MaxMcAdam/v2.31
Browse files Browse the repository at this point in the history
Agent cancels agreement after built-in property change
  • Loading branch information
bencourliss authored Jun 7, 2024
2 parents 820bc08 + 424d5b8 commit 4ffb1cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions agreement/agreement.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,11 @@ func (w *AgreementWorker) syncOnInit() error {

} else if proposal, err := w.producerPH[ag.AgreementProtocol].AgreementProtocolHandler("", "", "").DemarshalProposal(ag.Proposal); err != nil {
glog.Errorf(logString(fmt.Sprintf("unable to demarshal proposal for agreement %v, error %v", ag.CurrentAgreementId, err)))
} else if pol, err := policy.DemarshalPolicy(proposal.ProducerPolicy()); err != nil {
glog.Errorf(logString(fmt.Sprintf("unable to demarshal policy for agreement %v, error %v", ag.CurrentAgreementId, err)))
} else if nodePol, err := persistence.FindNodePolicy(w.db); err != nil {
glog.Errorf(logString(fmt.Sprintf("unable to read node policy from the local database. %v", err)))

} else if pol, err := policy.GenPolicyFromExternalPolicy(nodePol.GetDeploymentPolicy(), policy.MakeExternalPolicyHeaderName(w.GetExchangeId())); err != nil {
glog.Errorf(logString(fmt.Sprintf("Failed to convert node policy to policy file format: %v", err)))
} else if policies, err := w.pm.GetPolicyList(exchange.GetOrg(w.GetExchangeId()), pol); err != nil {
glog.Errorf(logString(fmt.Sprintf("unable to get policy list for producer policy in agreement %v, error: %v", ag.CurrentAgreementId, err)))
w.Messages() <- events.NewInitAgreementCancelationMessage(events.AGREEMENT_ENDED, w.producerPH[ag.AgreementProtocol].GetTerminationCode(producer.TERM_REASON_POLICY_CHANGED), ag.AgreementProtocol, ag.CurrentAgreementId, ag.GetDeploymentConfig())
Expand Down

0 comments on commit 4ffb1cd

Please sign in to comment.