osbuild2: LVM2Metadata: only validate CreationTime if not empty
It is ok to not pass the creation time to osbuild, i.e. it can be empty. If so, don't validate it. Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
This commit is contained in:
parent
2314ca37d7
commit
3c6e34aeb3
1 changed files with 4 additions and 2 deletions
|
|
@ -27,8 +27,10 @@ func (o LVM2MetadataStageOptions) validate() error {
|
|||
return fmt.Errorf("volume group name %q doesn't conform to schema (%s)", o.VGName, nameRegex.String())
|
||||
}
|
||||
|
||||
if _, err := strconv.ParseUint(o.CreationTime, 10, 64); err != nil {
|
||||
return fmt.Errorf("invalid volume creation time: %s", o.CreationTime)
|
||||
if o.CreationTime != "" {
|
||||
if _, err := strconv.ParseUint(o.CreationTime, 10, 64); err != nil {
|
||||
return fmt.Errorf("invalid volume creation time: %s", o.CreationTime)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue