Documentation ¶
Index ¶
- Constants
- type HardWareConf
- type OSInstallAgent
- func (agent *OSInstallAgent) GetHardWareConf() error
- func (agent *OSInstallAgent) ImplementHardConf() error
- func (agent *OSInstallAgent) IsHaveHardWareConf() (bool, error)
- func (agent *OSInstallAgent) IsInInstallQueue()
- func (agent *OSInstallAgent) IsIpInUse() error
- func (agent *OSInstallAgent) Reboot() error
- func (agent *OSInstallAgent) ReportMacInfo() error
- func (agent *OSInstallAgent) ReportProductInfo() error
- func (agent *OSInstallAgent) ReportProgress(installProgress float64, title, installLog string) bool
- func (agent *OSInstallAgent) RunPostInstallScript()
- func (agent *OSInstallAgent) RunPreInstallScript()
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 ¶
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 (*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) 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
Click to show internal directories.
Click to hide internal directories.