forked from TrueCloudLab/frostfs-node
[#397] ir: Make UN-LOCODE attribute of the network map candidate optional
Previously UN-LOCODE attribute was required for each network map candidate. In the absence of this attribute, the candidate was not allowed into the network map. After revising the requirements for candidates, it was decided not to require the mandatory installation of the attribute by candidates. From now inner ring does not modify location attributes of the network map candidate in the absence of UN-LOCODE attribute and does not block entry into the network map for this criterion. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
5f800458a3
commit
bcfd33d9fb
1 changed files with 3 additions and 4 deletions
|
@ -6,14 +6,13 @@ import (
|
|||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var errMissingLocode = errors.New("missing locode attribute")
|
||||
|
||||
var errMissingRequiredAttr = errors.New("missing required attribute in DB record")
|
||||
|
||||
// VerifyAndUpdate validates UN-LOCODE attribute of n
|
||||
// and adds a group of related attributes.
|
||||
//
|
||||
// If n does not contain UN-LOCODE attribute or its value does not
|
||||
// If n does not contain UN-LOCODE attribute, nil is returned
|
||||
// without any actions. Otherwise, if UN-LOCODE value does not
|
||||
// match the UN/LOCODE format, an error returns.
|
||||
//
|
||||
// New attributes are formed from the record of DB instance (Prm).
|
||||
|
@ -32,7 +31,7 @@ func (v *Validator) VerifyAndUpdate(n *netmap.NodeInfo) error {
|
|||
|
||||
attrLocode, ok := mAttr[netmap.AttrUNLOCODE]
|
||||
if !ok {
|
||||
return errMissingLocode
|
||||
return nil
|
||||
}
|
||||
|
||||
lc, err := locode.FromString(attrLocode.Value())
|
||||
|
|
Loading…
Reference in a new issue