Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateOptimumValue(operator Operator, currentValue string, expectedValue string) (string, error)
- func GetINIFileDescriptiveName(fileName string) string
- func GetINIFileVersionSectionEntry(fileName, entryName string) string
- func GetINIFileVersionSectionRefs(fileName string) []string
- func GetSysctlExcludes(skipFiles string)
- func ResetVersionSectCnts(tag string)
- func StoreSectionInfo(obj *INIFile, file, ID string, overwriteExisting bool) error
- type INIEntry
- type INIFile
- type Operator
- type Sysconfig
- func (conf *Sysconfig) GetBool(key string, defaultValue bool) bool
- func (conf *Sysconfig) GetInt(key string, defaultValue int) int
- func (conf *Sysconfig) GetIntArray(key string, defaultValue []int) (ret []int)
- func (conf *Sysconfig) GetString(key, defaultValue string) string
- func (conf *Sysconfig) GetStringArray(key string, defaultValue []string) (ret []string)
- func (conf *Sysconfig) GetUint64(key string, defaultValue uint64) uint64
- func (conf *Sysconfig) IsKeyAvail(key string) bool
- func (conf *Sysconfig) Set(key string, value interface{})
- func (conf *Sysconfig) SetIntArray(key string, values []int)
- func (conf *Sysconfig) SetStrArray(key string, values []string)
- func (conf *Sysconfig) ToText() string
- type SysconfigEntry
Constants ¶
const ( OperatorLessThan = "<" OperatorLessThanEqual = "<=" OperatorMoreThan = ">" OperatorMoreThanEqual = ">=" OperatorEqual = "=" )
Operator definitions
const OverrideTuningSheets = "/etc/saptune/override/"
OverrideTuningSheets defines saptunes override directory
Variables ¶
var RegexKeyOperatorValue = regexp.MustCompile(`([\w.+_-]+)\s*([<=>]+)\s*["']*(.*?)["']*$`)
RegexKeyOperatorValue breaks up a line into key, operator, value.
Functions ¶
func CalculateOptimumValue ¶
func CalculateOptimumValue(operator Operator, currentValue string, expectedValue string) (string, error)
CalculateOptimumValue calculates optimum parameter value given the current value, comparison operator, and expected value. Return optimised value.
func GetINIFileDescriptiveName ¶
GetINIFileDescriptiveName return the descriptive name of the Note
func GetINIFileVersionSectionEntry ¶
GetINIFileVersionSectionEntry returns the field 'entryName' from the version section of the Note configuration file
func GetINIFileVersionSectionRefs ¶
GetINIFileVersionSectionRefs returns the reference field from the version section of the Note configuration file
func GetSysctlExcludes ¶
func GetSysctlExcludes(skipFiles string)
GetSysctlExcludes gets the content of the /etc/sysconfig/saptune variable 'SKIP_SYSCTL_FILES' and provides it as slice
func ResetVersionSectCnts ¶
func ResetVersionSectCnts(tag string)
ResetVersionSectCnts resets the counters to control the error message of missing or wrong version section the warning message for the use of old style version section needed for staging to get the Warnings and Errors displayed
Types ¶
type INIFile ¶
INIFile contains all key-value pairs of an INI file.
func GetOverrides ¶
GetOverrides is looking for an override file and parse the content
func GetSectionInfo ¶
GetSectionInfo reads content of stored INIFile information. Return the content as INIFile
type Operator ¶
type Operator string
Operator is the comparison or assignment operator used in an INI file entry
type Sysconfig ¶
type Sysconfig struct { AllValues []*SysconfigEntry // All key-value pairs in the orignal order. KeyValue map[string]*SysconfigEntry }
Sysconfig contains key-value pairs of a sysconfig file. It is able to convert back to original text in the original key order.
func ParseSysconfig ¶
ParseSysconfig read sysconfig text and parse the text into memory structures.
func ParseSysconfigFile ¶
ParseSysconfigFile read sysconfig file and parse the file content into memory structures.
func (*Sysconfig) GetBool ¶
GetBool return bool value that belongs to the key, or the default value if key does not exist. True values are "yes" or "true".
func (*Sysconfig) GetInt ¶
GetInt return integer value that belongs to the key, or the default value if the key does not exist or value is not an integer.
func (*Sysconfig) GetIntArray ¶
GetIntArray assume the key carries a space-separated array of integers, return the array. Discard malformed integers.
func (*Sysconfig) GetString ¶
GetString return string value that belongs to the key, or the default value if the key does not exist.
func (*Sysconfig) GetStringArray ¶
GetStringArray assume the key carries a space-separated array value, return the value array.
func (*Sysconfig) GetUint64 ¶
GetUint64 return uint64 value that belongs to the key, or the default value if the key does not exist or value is not an integer.
func (*Sysconfig) IsKeyAvail ¶
IsKeyAvail return true, if the key is available. false, if the key does not exist.
func (*Sysconfig) SetIntArray ¶
SetIntArray give a space-separated integer array value to a key. If the key does not yet exist, it is created.
func (*Sysconfig) SetStrArray ¶
SetStrArray give a space-separated string array value to a key. If the key does not yet exist, it is created.
type SysconfigEntry ¶
type SysconfigEntry struct { LeadingComments []string // The comment lines leading to the key-value pair, including prefix '#', excluding end-of-line. Key string // The key. Value string // The value, excluding '=' character and double-quotes. Values will always come in double-quotes when converted to text. }
SysconfigEntry contains a single key-value pair in sysconfig file.