• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

essentialkaos / ek / 24389768914

14 Apr 2026 08:46AM UTC coverage: 99.307% (-0.07%) from 99.372%
24389768914

push

github

web-flow
Merge pull request #645 from essentialkaos/develop

Version 14.0.0

2148 of 2175 new or added lines in 105 files covered. (98.76%)

11 existing lines in 5 files now uncovered.

15196 of 15302 relevant lines covered (99.31%)

98.03 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.24
/knf/validators/system/validators_linux.go
1
// Package system provides KNF validators for checking system items (user, groups,
2
// network interfaces)
3
package system
4

5
// ////////////////////////////////////////////////////////////////////////////////// //
6
//                                                                                    //
7
//                         Copyright (c) 2026 ESSENTIAL KAOS                          //
8
//      Apache License, Version 2.0 <https://www.apache.org/licenses/LICENSE-2.0>     //
9
//                                                                                    //
10
// ////////////////////////////////////////////////////////////////////////////////// //
11

12
import (
13
        "fmt"
14

15
        "github.com/essentialkaos/ek/v14/knf"
16
        "github.com/essentialkaos/ek/v14/system"
17
)
18

19
// ////////////////////////////////////////////////////////////////////////////////// //
20

21
var (
22
        // Interface returns error if configuration property contains name of network
23
        // interface which not present on the system
24
        Interface = validateInterface
25
)
26

27
// ////////////////////////////////////////////////////////////////////////////////// //
28

29
func validateInterface(config knf.IConfig, prop string, value any) error {
6✔
30
        v := config.GetS(prop)
6✔
31

6✔
32
        if v == "" {
8✔
33
                return nil
2✔
34
        }
2✔
35

36
        stats, err := system.GetInterfacesStats()
4✔
37

4✔
38
        if err != nil {
4✔
NEW
39
                return fmt.Errorf("can't get interfaces info: %v", err)
×
40
        }
×
41

42
        _, isPresent := stats[v]
4✔
43

4✔
44
        if !isPresent {
6✔
45
                return fmt.Errorf("interface %q is not present on the system", v)
2✔
46
        }
2✔
47

48
        return nil
2✔
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc