feat(aa): add initial profile validation structure.
This commit is contained in:
parent
2dd6046697
commit
92641e7e28
20 changed files with 222 additions and 2 deletions
|
|
@ -42,6 +42,10 @@ func newMountConditionsFromLog(log map[string]string) MountConditions {
|
|||
return MountConditions{FsType: log["fstype"]}
|
||||
}
|
||||
|
||||
func (m MountConditions) Validate() error {
|
||||
return validateValues(tokMOUNT, "flags", m.Options)
|
||||
}
|
||||
|
||||
func (m MountConditions) Less(other MountConditions) bool {
|
||||
if m.FsType != other.FsType {
|
||||
return m.FsType < other.FsType
|
||||
|
|
@ -71,6 +75,13 @@ func newMountFromLog(log map[string]string) Rule {
|
|||
}
|
||||
}
|
||||
|
||||
func (r *Mount) Validate() error {
|
||||
if err := r.MountConditions.Validate(); err != nil {
|
||||
return fmt.Errorf("%s: %w", r, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Mount) Less(other any) bool {
|
||||
o, _ := other.(*Mount)
|
||||
if r.Source != o.Source {
|
||||
|
|
@ -120,6 +131,13 @@ func newUmountFromLog(log map[string]string) Rule {
|
|||
}
|
||||
}
|
||||
|
||||
func (r *Umount) Validate() error {
|
||||
if err := r.MountConditions.Validate(); err != nil {
|
||||
return fmt.Errorf("%s: %w", r, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Umount) Less(other any) bool {
|
||||
o, _ := other.(*Umount)
|
||||
if r.MountPoint != o.MountPoint {
|
||||
|
|
@ -166,6 +184,13 @@ func newRemountFromLog(log map[string]string) Rule {
|
|||
}
|
||||
}
|
||||
|
||||
func (r *Remount) Validate() error {
|
||||
if err := r.MountConditions.Validate(); err != nil {
|
||||
return fmt.Errorf("%s: %w", r, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Remount) Less(other any) bool {
|
||||
o, _ := other.(*Remount)
|
||||
if r.MountPoint != o.MountPoint {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue