|
|
@ -71,7 +71,6 @@ type SDConfig struct {
|
|
|
|
RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"`
|
|
|
|
RefreshInterval model.Duration `yaml:"refresh_interval,omitempty"`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Uyuni API Response structures
|
|
|
|
|
|
|
|
type systemGroupID struct {
|
|
|
|
type systemGroupID struct {
|
|
|
|
GroupID int `xmlrpc:"id"`
|
|
|
|
GroupID int `xmlrpc:"id"`
|
|
|
|
GroupName string `xmlrpc:"name"`
|
|
|
|
GroupName string `xmlrpc:"name"`
|
|
|
@ -142,19 +141,16 @@ func (c *SDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Attempt to login in Uyuni Server and get an auth token
|
|
|
|
|
|
|
|
func login(rpcclient *xmlrpc.Client, user string, pass string) (string, error) {
|
|
|
|
func login(rpcclient *xmlrpc.Client, user string, pass string) (string, error) {
|
|
|
|
var result string
|
|
|
|
var result string
|
|
|
|
err := rpcclient.Call("auth.login", []interface{}{user, pass}, &result)
|
|
|
|
err := rpcclient.Call("auth.login", []interface{}{user, pass}, &result)
|
|
|
|
return result, err
|
|
|
|
return result, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Logout from Uyuni API
|
|
|
|
|
|
|
|
func logout(rpcclient *xmlrpc.Client, token string) error {
|
|
|
|
func logout(rpcclient *xmlrpc.Client, token string) error {
|
|
|
|
return rpcclient.Call("auth.logout", token, nil)
|
|
|
|
return rpcclient.Call("auth.logout", token, nil)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Get the system groups information of monitored clients
|
|
|
|
|
|
|
|
func getSystemGroupsInfoOfMonitoredClients(rpcclient *xmlrpc.Client, token string, entitlement string) (map[int][]systemGroupID, error) {
|
|
|
|
func getSystemGroupsInfoOfMonitoredClients(rpcclient *xmlrpc.Client, token string, entitlement string) (map[int][]systemGroupID, error) {
|
|
|
|
var systemGroupsInfos []struct {
|
|
|
|
var systemGroupsInfos []struct {
|
|
|
|
SystemID int `xmlrpc:"id"`
|
|
|
|
SystemID int `xmlrpc:"id"`
|
|
|
@ -173,7 +169,6 @@ func getSystemGroupsInfoOfMonitoredClients(rpcclient *xmlrpc.Client, token strin
|
|
|
|
return result, nil
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// GetSystemNetworkInfo lists client FQDNs.
|
|
|
|
|
|
|
|
func getNetworkInformationForSystems(rpcclient *xmlrpc.Client, token string, systemIDs []int) (map[int]networkInfo, error) {
|
|
|
|
func getNetworkInformationForSystems(rpcclient *xmlrpc.Client, token string, systemIDs []int) (map[int]networkInfo, error) {
|
|
|
|
var networkInfos []networkInfo
|
|
|
|
var networkInfos []networkInfo
|
|
|
|
err := rpcclient.Call("system.getNetworkForSystems", []interface{}{token, systemIDs}, &networkInfos)
|
|
|
|
err := rpcclient.Call("system.getNetworkForSystems", []interface{}{token, systemIDs}, &networkInfos)
|
|
|
@ -188,7 +183,6 @@ func getNetworkInformationForSystems(rpcclient *xmlrpc.Client, token string, sys
|
|
|
|
return result, nil
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Get endpoints information for given systems
|
|
|
|
|
|
|
|
func getEndpointInfoForSystems(
|
|
|
|
func getEndpointInfoForSystems(
|
|
|
|
rpcclient *xmlrpc.Client,
|
|
|
|
rpcclient *xmlrpc.Client,
|
|
|
|
token string,
|
|
|
|
token string,
|
|
|
|