示例#1
0
// SetString sets the guestinfo.KEY with the string VALUE
func (c *Config) SetString(key string, value string) error {
	_, _, err := rpcout.SendOne("info-set guestinfo.%s %s", key, value)
	if err != nil {
		return err
	}
	return nil
}
示例#2
0
// String returns the config string in the guestinfo.* namespace
func (c *Config) String(key string, defaultValue string) (string, error) {
	out, ok, err := rpcout.SendOne("info-get guestinfo.%s", key)
	if err != nil {
		return "", err
	} else if !ok {
		return defaultValue, nil
	}
	return string(out), nil
}