utils

package
v0.0.0-...-c232087 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package utils contains helper utils for osconfig_tests.

Index

Constants

This section is empty.

Variables

View Source
var (

	// CosSetup sets up serial logging on COS.
	CosSetup = `
sleep 10
sed -i 's/^#ForwardToConsole=no/ForwardToConsole=yes/' /etc/systemd/journald.conf
sed -i 's/^#MaxLevelConsole=info/MaxLevelConsole=debug/' /etc/systemd/journald.conf
MaxLevelConsole=debug
systemctl force-reload systemd-journald
systemctl restart google-osconfig-agent` + CurlPost

	// CurlPost indicates agent is installed.
	CurlPost = `` /* 325-byte string literal not displayed */

)
View Source
var DowngradeBullseyeAptImages = map[string]string{
	"debian-cloud/debian-11": "projects/debian-cloud/global/images/debian-11-bullseye-v20231010",
}

DowngradeBullseyeAptImages is a single image that are used for testing downgrade case with apt-get

View Source
var HeadAptImages = func() (newMap map[string]string) {
	newMap = make(map[string]string)
	for k, v := range HeadBusterAptImages {
		newMap[k] = v
	}
	for k, v := range HeadBullseyeAptImages {
		newMap[k] = v
	}
	for k, v := range HeadBookwormAptImages {
		newMap[k] = v
	}
	return
}()

HeadAptImages is a map of names to image paths for public EL image families. (RHEL, CentOS, Rocky)

View Source
var HeadBookwormAptImages = map[string]string{

	"debian-cloud/debian-12": "projects/debian-cloud/global/images/family/debian-12",
}

HeadBookwormAptImages is a map of names to image paths for public debian-12 images

View Source
var HeadBullseyeAptImages = map[string]string{

	"debian-cloud/debian-11": "projects/debian-cloud/global/images/family/debian-11",
}

HeadBullseyeAptImages is a map of names to image paths for public debian-11 images

View Source
var HeadBusterAptImages = map[string]string{}

HeadBusterAptImages empty for now as debian-10 wil reach EOL and some of its repos are not reachable anymore.

View Source
var HeadCOSImages = map[string]string{
	"cos-cloud/cos-stable": "projects/cos-cloud/global/images/family/cos-stable",
	"cos-cloud/cos-beta":   "projects/cos-cloud/global/images/family/cos-beta",
	"cos-cloud/cos-dev":    "projects/cos-cloud/global/images/family/cos-dev",
}

HeadCOSImages is a map of names to image paths for public COS image families.

View Source
var HeadEL8Images = map[string]string{
	"rhel-cloud/rhel-8": "projects/rhel-cloud/global/images/family/rhel-8",

	"rhel-sap-cloud/rhel-8-4-sap": "projects/rhel-sap-cloud/global/images/family/rhel-8-4-sap-ha",
	"rhel-sap-cloud/rhel-8-6-sap": "projects/rhel-sap-cloud/global/images/family/rhel-8-6-sap-ha",
	"rhel-sap-cloud/rhel-8-8-sap": "projects/rhel-sap-cloud/global/images/family/rhel-8-8-sap-ha",

	"rocky-linux-cloud/rocky-linux-8":               "projects/rocky-linux-cloud/global/images/family/rocky-linux-8",
	"rocky-linux-cloud/rocky-linux-8-optimized-gcp": "projects/rocky-linux-cloud/global/images/family/rocky-linux-8-optimized-gcp",
}

HeadEL8Images is a map of names to image paths for public EL8 image families. (RHEL, CentOS, Rocky)

View Source
var HeadEL9Images = map[string]string{
	"centos-cloud/centos-stream-9": "projects/centos-cloud/global/images/family/centos-stream-9",

	"rhel-cloud/rhel-9": "projects/rhel-cloud/global/images/family/rhel-9",

	"rhel-sap-cloud/rhel-9-0-sap": "projects/rhel-sap-cloud/global/images/family/rhel-9-0-sap-ha",
	"rhel-sap-cloud/rhel-9-2-sap": "projects/rhel-sap-cloud/global/images/family/rhel-9-2-sap-ha",

	"rocky-linux-cloud/rocky-linux-9":               "projects/rocky-linux-cloud/global/images/family/rocky-linux-9",
	"rocky-linux-cloud/rocky-linux-9-optimized-gcp": "projects/rocky-linux-cloud/global/images/family/rocky-linux-9-optimized-gcp",
}

HeadEL9Images is a map of names to image paths for public EL9 image families. (RHEL, CentOS, Rocky)

View Source
var HeadELImages = func() (newMap map[string]string) {
	newMap = make(map[string]string)
	for k, v := range HeadEL8Images {
		newMap[k] = v
	}
	for k, v := range HeadEL9Images {
		newMap[k] = v
	}
	return
}()

HeadELImages is a map of names to image paths for public EL image families. (RHEL, CentOS, Rocky)

View Source
var HeadSUSEImages = func() map[string]string {
	imgsMap := make(map[string]string)

	if config.AgentRepo() != "testing" {
		imgsMap = map[string]string{
			"suse-cloud/sles-12-sp5": "projects/suse-cloud/global/images/family/sles-12",
			"suse-cloud/sles-15-sp5": "projects/suse-cloud/global/images/family/sles-15",

			"suse-sap-cloud/sles-12-sp5-sap": "projects/suse-sap-cloud/global/images/family/sles-12-sp5-sap",
			"suse-sap-cloud/sles-15-sp5-sap": "projects/suse-sap-cloud/global/images/family/sles-15-sp5-sap",
			"suse-sap-cloud/sles-15-sp6-sap": "projects/suse-sap-cloud/global/images/family/sles-15-sp6-sap",

			"suse-sap-cloud/sles-15-sp5-hardened-sap": "projects/suse-sap-cloud/global/images/family/sles-sap-15-sp5-hardened",

			"opensuse-cloud/opensuse-leap-15": "projects/opensuse-cloud/global/images/family/opensuse-leap",
		}
	}
	return imgsMap
}()

HeadSUSEImages is a map of names to image paths for public SUSE images.

View Source
var HeadWindowsImages = map[string]string{
	"windows-cloud/windows-2016":      "projects/windows-cloud/global/images/family/windows-2016",
	"windows-cloud/windows-2016-core": "projects/windows-cloud/global/images/family/windows-2016-core",
	"windows-cloud/windows-2019":      "projects/windows-cloud/global/images/family/windows-2019",
	"windows-cloud/windows-2019-core": "projects/windows-cloud/global/images/family/windows-2019-core",
}

HeadWindowsImages is a map of names to image paths for public Windows image families.

View Source
var OldEL8Images = map[string]string{}

OldEL8Images is a map of names to image paths for old EL8 images. (RHEL, CentOS, Rocky)

View Source
var OldEL9Images = map[string]string{}

OldEL9Images is a map of names to image paths for old EL9 images. (RHEL, CentOS, Rocky)

View Source
var OldSUSEImages = func() map[string]string {
	imgsMap := make(map[string]string)

	if config.AgentRepo() != "testing" {
		imgsMap = map[string]string{
			"old/sles-15-sp3-sap": "projects/suse-sap-cloud/global/images/sles-15-sp3-sap-v20240808-x86-64",
			"old/sles-15-sp4-sap": "projects/suse-sap-cloud/global/images/sles-15-sp4-sap-v20240208-x86-64",
		}
	}
	return imgsMap
}()

OldSUSEImages is a map of names to image paths for public SUSE images.

View Source
var OldWindowsImages = map[string]string{}

OldWindowsImages is a map of names to image paths for old Windows images.

Functions

func CreateComputeInstance

func CreateComputeInstance(metadataitems []*api.MetadataItems, client daisyCompute.Client, machineType, image, name, projectID, zone, serviceAccountEmail string, serviceAccountScopes []string) (*compute.Instance, error)

CreateComputeInstance is an utility function to create gce instance

func GetDebOsName

func GetDebOsName(image string) string

GetDebOsName returns the equivalent os_name for deb version (e.g. debian-11 --> bullseye)

func GetStatusFromError

func GetStatusFromError(err error) string

GetStatusFromError return a string that contains all information about the error that is created from a status

func InstallOSConfigDeb

func InstallOSConfigDeb(image string) string

InstallOSConfigDeb installs the osconfig agent on deb based systems.

func InstallOSConfigEL

func InstallOSConfigEL(image string) string

InstallOSConfigEL installs the osconfig agent on el based systems.

func InstallOSConfigEL7

func InstallOSConfigEL7() string

InstallOSConfigEL7 installs the osconfig agent on el7 based systems.

func InstallOSConfigEL8

func InstallOSConfigEL8() string

InstallOSConfigEL8 installs the osconfig agent on el8 based systems. (RHEL)

func InstallOSConfigEL9

func InstallOSConfigEL9() string

InstallOSConfigEL9 installs the osconfig agent on el9 based systems. (RHEL)

func InstallOSConfigGooGet

func InstallOSConfigGooGet() string

InstallOSConfigGooGet installs the osconfig agent on Windows systems.

func InstallOSConfigSUSE

func InstallOSConfigSUSE() string

InstallOSConfigSUSE installs the osconfig agent on suse systems.

func RandString

func RandString(n int) string

RandString generates a random string of n length.

Types

This section is empty.

Jump to

Keyboard shortcuts

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