当前位置: 首页>>代码示例>>Golang>>正文


Golang command.ExecuteWithOutput函数代码示例

本文整理汇总了Golang中github.com/jiasir/playback/command.ExecuteWithOutput函数的典型用法代码示例。如果您正苦于以下问题:Golang ExecuteWithOutput函数的具体用法?Golang ExecuteWithOutput怎么用?Golang ExecuteWithOutput使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ExecuteWithOutput函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: AddOSD

// AddOSD add the Ceph OSDs.
// Only sopport sdb and sdc.
// The method takes the following commands of Playback:
//  playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute01 disk=sdb partition=sdb1" -vvvv'
//  playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute01 disk=sdc partition=sdc1" -vvvv'
//  playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute02 disk=sdb partition=sdb1" -vvvv'
//  playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute02 disk=sdc partition=sdc1" -vvvv'
//  playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute03 disk=sdb partition=sdb1" -vvvv'
//  playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute03 disk=sdc partition=sdc1" -vvvv'
//  playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute04 disk=sdb partition=sdb1" -vvvv'
//  playback --ansible 'openstack_ceph_osd.yml --extra-vars "node=compute04 disk=sdc partition=sdc1" -vvvv'
// Only support two nodes for sdb and sdc currently.
func (vars ExtraVars) AddOSD() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_osd.yml", "--extra-vars", "node="+vars.NodeSlice[0], "disk=sdb", "partition=sdb1", "-vvvv")
	command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_osd.yml", "--extra-vars", "node="+vars.NodeSlice[0], "disk=sdc", "partition=sdc1", "-vvvv")
	command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_osd.yml", "--extra-vars", "node="+vars.NodeSlice[1], "disk=sdb", "partition=sdb1", "-vvvv")
	command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_osd.yml", "--extra-vars", "node="+vars.NodeSlice[1], "disk=sdc", "partition=sdc1", "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:19,代码来源:openstack.go

示例2: MariadbCluster

// MariadbCluster deploy MariaDB Cluster.
// The method takes the following commands of Playback:
//  playback --ansible 'openstack_mariadb.yml --extra-vars "host=controller01 my_ip=192.169.151.19" -vvvv'
//  playback --ansible 'openstack_mariadb.yml --extra-vars "host=controller02 my_ip=192.169.151.17" -vvvv'
//  python keepalived.py
func (vars ExtraVars) MariadbCluster() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_mariadb.yml", "--extra-vars", "host="+vars.HostName, "my_ip="+vars.MyIP, "-vvvv")
	if vars.HostName == "controller02" {
		command.ExecuteWithOutput("python keepalived.py")
	}
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:12,代码来源:openstack.go

示例3: ConfigureStorageNetwork

// ConfigureStorageNetwork takes playback-nic to set up the storage network.
// Purge the configuration and set address to 192.169.151.19 for eth1 of host 192.169.150.19 as public interface:
//	playback-nic --purge --public --host 192.169.150.19 --user ubuntu --address 192.169.151.19 --nic eth1 --netmask 255.255.255.0 --gateway 192.169.151.1 --dns-nameservers "192.169.11.11 192.169.11.12"
//Setting address to 192.168.1.12 for eth2 of host 192.169.150.19 as private interface:
//	playback-nic --private --host 192.169.150.19 --user ubuntu --address 192.168.1.12 --nic eth2 --netmask 255.255.255.0
func (vars ExtraVars) ConfigureStorageNetwork() error {
	if vars.PlaybackNic.Purge {
		if vars.PlaybackNic.Public {
			command.ExecuteWithOutput("playback-nic", "--purge", "--public", "--host", vars.PlaybackNic.Host, "--user", vars.PlaybackNic.User, "--address", vars.PlaybackNic.Address, "--nic", vars.PlaybackNic.NIC, "--netmask", vars.PlaybackNic.Netmask, "--gateway", vars.PlaybackNic.Gateway, "--dns-nameservers", vars.PlaybackNic.DNS)
		}
	}
	if vars.PlaybackNic.Private {
		command.ExecuteWithOutput("playback-nic", "--private", "--host", vars.PlaybackNic.Host, "--user", vars.PlaybackNic.Host, "--address", vars.PlaybackNic.Address, "--nic", vars.PlaybackNic.NIC, "--netmask", vars.PlaybackNic.Netmask)
	}
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:16,代码来源:openstack.go

示例4: Run

// Run takes provision-api command.
func (p provision) Run(args []string) int {
	// TODO: Refactor arg parse.
	// TODO: Refactor exit status.
	for _, arg := range args {
		if arg == "start" {
			command.ExecuteWithOutput("provision-api")
		}
	}
	return 0
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:11,代码来源:main.go

示例5: InitSwiftRings

// InitSwiftRings initial Swift rings.
// The method takes the following commands of Playback:
//  playback --ansible 'openstack_swift_builder_file.yml -vvvv'
//  playback --ansible 'openstack_swift_add_node_to_the_ring.yml --extra-vars "swift_storage_storage_ip=192.168.1.16 device_name=sdb1 device_weight=100" -vvvv'
//  playback --ansible 'openstack_swift_add_node_to_the_ring.yml --extra-vars "swift_storage_storage_ip=192.168.1.16 device_name=sdc1 device_weight=100" -vvvv'
//  playback --ansible 'openstack_swift_add_node_to_the_ring.yml --extra-vars "swift_storage_storage_ip=192.168.1.15 device_name=sdb1 device_weight=100" -vvvv'
//  playback --ansible 'openstack_swift_add_node_to_the_ring.yml --extra-vars "swift_storage_storage_ip=192.168.1.15 device_name=sdc1 device_weight=100" -vvvv'
//  playback --ansible 'openstack_swift_rebalance_ring.yml -vvvv'
func (vars ExtraVars) InitSwiftRings() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_builder_file.yml", "-vvvv")
	command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_add_node_to_the_ring.yml", "--extra-vars", "swift_storage_storage_ip="+vars.SwiftStorageStorageIP[0], "device_name=sdb1", "device_weight=100", "-vvvv")
	command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_add_node_to_the_ring.yml", "--extra-vars", "swift_storage_storage_ip="+vars.SwiftStorageStorageIP[0], "device_name=sdc1", "device_weight=100", "-vvvv")
	command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_add_node_to_the_ring.yml", "--extra-vars", "swift_storage_storage_ip="+vars.SwiftStorageStorageIP[1], "device_name=sdb1", "device_weight=100", "-vvvv")
	command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_add_node_to_the_ring.yml", "--extra-vars", "swift_storage_storage_ip="+vars.SwiftStorageStorageIP[1], "device_name=sdc1", "device_weight=100", "-vvvv")
	command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_rebalance_ring.yml", "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:17,代码来源:openstack.go

示例6: main

func main() {
	var interfaces = new(common.Interfaces)
	// ansible puts module args to a file wich is os.Args[1] on remote server
	data, err := ioutil.ReadFile(os.Args[1])
	if err != nil {
		panic(err)
	}
	args := strings.Split(string(data), " ") // [k=v k=v k=v]

	// arg is k=v
	for _, arg := range args {
		if strings.Contains(arg, "=") {
			k := strings.Split(arg, "=")[0] // the key
			v := strings.Split(arg, "=")[1] // the value
			// set the k v to struct
			interfaces.InitInterfaces(k, v)
		}
	}

	interfaces.Changed = true
	// use interfaces.d instead of /etc/network/interfaces
	interfaces.PurgeMainConf()
	// setup internal nic
	interfaces.SetInternalNIC()

	if interfaces.ExternalNIC != "" {
		// setup external nic
		interfaces.SetExternalNIC()
	}

	if interfaces.Restart {
		// restart the system for take effect
		command.ExecuteWithOutput("sudo", "shuwdown", "-r", "+1", "FastForward takes reboot")
	}

	output, err := json.Marshal(*interfaces) //produce JSON from interfaces struct
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("%s", output)
	}

}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:43,代码来源:main.go

示例7: SyncCephKey

// SyncCephKey copy the Ceph keys to nodes.
// Copy the configuration file and admin key to your admin node and your Ceph Nodes so that you can use the ceph CLI without having to specify the monitor address and ceph.client.admin.keyring each time you execute a command.
// The method takes the following commands of Playback:
//  playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=controller01" -vvvv'
//  playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=controller02" -vvvv'
//  playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=compute01" -vvvv'
//  playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=compute02" -vvvv'
//  playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=compute03" -vvvv'
//  playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=compute04" -vvvv'
//  playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=compute05" -vvvv'
//  playback --ansible 'openstack_ceph_copy_keys.yml --extra-vars "node=compute06" -vvvv'
func (vars ExtraVars) SyncCephKey() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_copy_keys.yml", "--extra-vars", "node="+vars.Node, "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:15,代码来源:openstack.go

示例8: CephUserPool

// CephUserPool creates the cinder ceph user and pool name.
// The method takes the following command of Playback:
//  playback --ansible 'openstack_ceph_cinder_pool_user.yml -vvvv'
func (vars ExtraVars) CephUserPool() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_cinder_pool_user.yml", "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:7,代码来源:openstack.go

示例9: LBOptimize

// LBOptimize optimizing load balancer.
// the method takes the floowing command of Playback:
//  python patch-limits.py
func (vars ExtraVars) LBOptimize() error {
	command.ExecuteWithOutput("python patch-limits.py")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:7,代码来源:openstack.go

示例10: AddCephMon

// AddCephMon add the Ceph monitors.
// The method takes the following command of Playback:
//  playback --ansible 'openstack_ceph_mon.yml --extra-vars "node=compute01" -vvvv'
//  playback --ansible 'openstack_ceph_mon.yml --extra-vars "node=compute02" -vvvv'
//  playback --ansible 'openstack_ceph_mon.yml --extra-vars "node=compute03" -vvvv'
//  playback --ansible 'openstack_ceph_mon.yml --extra-vars "node=compute04" -vvvv'
func (vars ExtraVars) AddCephMon() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_mon.yml", "--extra-vars", "node="+vars.Node, "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:10,代码来源:openstack.go

示例11: CephClient

// CephClient deploy the Ceph client.
// The method takes the following commands of Playback:
//  playback --ansible 'openstack_ceph_client.yml --extra-vars "client=controller01" -vvvv'
//  playback --ansible 'openstack_ceph_client.yml --extra-vars "client=controller02" -vvvv'
//  playback --ansible 'openstack_ceph_client.yml --extra-vars "client=compute01" -vvvv'
//  playback --ansible 'openstack_ceph_client.yml --extra-vars "client=compute02" -vvvv'
//  playback --ansible 'openstack_ceph_client.yml --extra-vars "client=compute03" -vvvv'
//  playback --ansible 'openstack_ceph_client.yml --extra-vars "client=compute04" -vvvv'
//  playback --ansible 'openstack_ceph_client.yml --extra-vars "client=compute05" -vvvv'
//  playback --ansible 'openstack_ceph_client.yml --extra-vars "client=compute06" -vvvv'
func (vars ExtraVars) CephClient() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_client.yml", "--extra-vars", "client="+vars.ClientName, "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:14,代码来源:openstack.go

示例12: GetCephKey

// GetCephKey add Ceph initial monitors and gather the keys.
// The method takes the following command of Playback:
//  playback --ansible 'openstack_ceph_gather_keys.yml -vvvv'
func (vars ExtraVars) GetCephKey() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_ceph_gather_keys.yml", "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:7,代码来源:openstack.go

示例13: Designate

// Designate deploy DNS as a Service.
// The method takes the following command of Playback:
//  playback --ansible openstack_dns.yml -vvvv
// Execute on controller01:
//  bash /mnt/designate-keystone-setup
//  nohup designate-central > /dev/null 2>&1 &
//  nohup designate-api > /dev/null 2>&1 &
func (vars ExtraVars) Designate() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_dns.yml", "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:11,代码来源:openstack.go

示例14: PrepareBasicEnvirionment

// PrepareBasicEnvirionment prepares OpenStack basic environment.
// The method takes the following command of Playback:
//  playback --ansible 'openstack_basic_environment.yml -vvvv'
func (vars ExtraVars) PrepareBasicEnvirionment() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_basic_environment.yml", "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:7,代码来源:openstack.go

示例15: Dashboard

// Dashboard deploy Horizon.
// The method takes the following command of Playback:
//  playback --ansible 'openstack_horizon.yml -vvvv'
func (vars ExtraVars) Dashboard() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_horizon.yml", "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:7,代码来源:openstack.go


注:本文中的github.com/jiasir/playback/command.ExecuteWithOutput函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。