facts

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2020 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFact

func GetFact(fact string, file string, log Logger) ([]byte, gjson.Result, error)

GetFact looks up a single fact from the facts file, errors reading the file is reported but an absent fact is handled as empty result and no error

func GetFactJSON

func GetFactJSON(fact string, facts json.RawMessage) (gjson.Result, error)

GetFactJSON looks up a single fact from the JSON data, absent fact is handled as empty result and no error

func HasFact

func HasFact(fact string, operator string, value string, file string, log Logger) (bool, error)

HasFact evaluates the expression against facts in the file

func HasFactJSON

func HasFactJSON(fact string, operator string, value string, facts json.RawMessage, log Logger) (bool, error)

func JSON

func JSON(file string, log Logger) (json.RawMessage, error)

JSON parses the data, including doing any conversions needed, and returns JSON text

func MatchFacts

func MatchFacts(filters [][3]string, facts json.RawMessage, log Logger) bool

MatchFacts match fact filters in a OR manner, only facts matching all filters will be true

func MatchFile

func MatchFile(filters [][3]string, file string, log Logger) bool

MatchFile match fact filters in a OR manner, only nodes that have all the matching facts will be true here

Types

type Logger

type Logger interface {
	Warnf(format string, args ...interface{})
	Debugf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
}

Logger provides logging facilities

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL