Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
stboot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
glasklar
infra
stboot
Commits
eea7959d
Commit
eea7959d
authored
1 year ago
by
Jens Drenhaus
Browse files
Options
Downloads
Patches
Plain Diff
host config: fix validation of network interfaces
Signed-off-by:
Jens Drenhaus
<
jens.drenhaus@9elements.com
>
parent
3453aa50
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
host/config.go
+12
-0
12 additions, 0 deletions
host/config.go
with
12 additions
and
0 deletions
host/config.go
+
12
−
0
View file @
eea7959d
...
...
@@ -30,6 +30,7 @@ var (
ErrMissingBondName
=
errors
.
New
(
"bond name must be set"
)
ErrInvalidBondMode
=
errors
.
New
(
"bond mode is unknown"
)
ErrMissingNetworkInterfaces
=
errors
.
New
(
"one or more network interfaces must be set"
)
ErrEmptyNetworkInterfaces
=
errors
.
New
(
"network interfaces are set but empty"
)
ErrMissingOSPkgPointer
=
errors
.
New
(
"missing OS package pointer"
)
ErrMissingIPAddr
=
errors
.
New
(
"field IP address must not be empty when static IP mode is set"
)
ErrMissingGateway
=
errors
.
New
(
"default gateway must not be empty when static IP mode is set"
)
...
...
@@ -304,6 +305,7 @@ func (c *Config) validate() error {
checkIPAddrMode
,
checkHostIP
,
checkGateway
,
checkNetworkInterfaces
,
checkOSPkgPointer
,
checkID
,
checkAuth
,
...
...
@@ -343,6 +345,16 @@ func checkGateway(cfg *Config) error {
return
nil
}
func
checkNetworkInterfaces
(
cfg
*
Config
)
error
{
if
cfg
.
NetworkInterfaces
!=
nil
{
if
len
(
*
cfg
.
NetworkInterfaces
)
==
0
{
return
ErrEmptyNetworkInterfaces
}
}
return
nil
}
func
checkOSPkgPointer
(
cfg
*
Config
)
error
{
if
cfg
.
OSPkgPointer
==
nil
{
return
ErrMissingOSPkgPointer
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment