agent

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetSNScript = `dmidecode -s system-serial-number 2>/dev/null | awk '/^[^#]/ { print $1 }'`
	// GetMacScript       = `ip addr show $(ip route get 10.0.0.0 | awk '/src/ { print $(NF-2) }') | awk '/ether/ { print $2 }'`
	GetCmdlineArgs     = `cat /proc/cmdline`
	RegexpServerAddr   = `SERVER_ADDR=([^ ]+)`
	RegexpLoopInterval = `LOOP_INTERVAL=([^ ]+)`
	RegexpDeveloper    = `DEVELOPER=([^ ]+)`
	RebootScript       = `ipmitool chassis bootdev pxe; ipmitool power reset`
	RebootScript2      = `fdisk -lu | awk '/^Disk.*bytes/ { gsub(/:/, ""); system("dd if=/dev/zero of="$2" bs=512 count=1") }'; reboot -f`
	InstallHWTools     = `rpm --quiet -q %s-hw-tools || yum -y install %s-hw-tools`
	PingIp             = `ping -c 4 -w 3 %s`

	APIVersion = "v1"

	ProductInfoScript       = `/usr/local/bin/sysinfo.sh`
	On                      = "1"
	Off                     = "0"
	PreInstallScript        = "/tmp/preInstall.cmd"
	PostInstallScript       = "/tmp/postInstall.cmd"
	RegexpPreInstallScript  = `PRE=([^ ]+)`
	RegexpPostInstallScript = `POST=([^ ]+)`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HardWareConf

type HardWareConf struct {
	Name    string
	Scripts []struct {
		Name   string
		Script string
	}
}

HardWareConf 硬件配置结构

type OSInstallAgent

type OSInstallAgent struct {
	Logger       logger.Logger
	Config       *config.Config
	Sn           string
	MacAddr      string
	ServerAddr   string
	LoopInterval int
	DevelopeMode string
	Company      string
	Product      string
	ModelName    string

	IsVm string //Whether it is a virtual machine
	// contains filtered or unexported fields
}

OSInstallAgent agent data struct

func New

func New() (*OSInstallAgent, error)

New create agent

func (*OSInstallAgent) GetHardWareConf

func (agent *OSInstallAgent) GetHardWareConf() error

GetHardConf 获取硬件配置

func (*OSInstallAgent) ImplementHardConf

func (agent *OSInstallAgent) ImplementHardConf() error

ImplementHardConf 实施硬件配置

func (*OSInstallAgent) IsHaveHardWareConf

func (agent *OSInstallAgent) IsHaveHardWareConf() (bool, error)

IsHaveHardWareConf 检查服务端是否此机器的硬件配置

func (*OSInstallAgent) IsInInstallQueue

func (agent *OSInstallAgent) IsInInstallQueue()

IsInInstallQueue 检查是否在装机队列中 (定时执行)

func (*OSInstallAgent) IsIpInUse

func (agent *OSInstallAgent) IsIpInUse() error

IsIPInUse 判断IP是否在使用中

func (*OSInstallAgent) Reboot

func (agent *OSInstallAgent) Reboot() error

Reboot 重启系统

func (*OSInstallAgent) ReportMacInfo

func (agent *OSInstallAgent) ReportMacInfo() error

ReportMacInfo 上报 mac 地址

func (*OSInstallAgent) ReportProductInfo

func (agent *OSInstallAgent) ReportProductInfo() error

func (*OSInstallAgent) ReportProgress

func (agent *OSInstallAgent) ReportProgress(installProgress float64, title, installLog string) bool

ReportProgress 上报执行结果

func (*OSInstallAgent) RunPostInstallScript

func (agent *OSInstallAgent) RunPostInstallScript()

run post install script

func (*OSInstallAgent) RunPreInstallScript

func (agent *OSInstallAgent) RunPreInstallScript()

run pre install script

Jump to

Keyboard shortcuts

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