• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang command.ExecuteWithOutput函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Heat

// Heat deploy orchestration components(heat).
// The method takes the following commands of Playback:
//  playback --ansible 'openstack_heat_controller.yml --extra-vars "host=controller01" -vvvv'
//  playback --ansible 'openstack_heat_controller.yml --extra-vars "host=controller02" -vvvv'
func (vars ExtraVars) Heat() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_heat_controller.yml", "--extra-vars", "host="+vars.HostName, "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:8,代码来源:openstack.go


示例17: CinderVolume

// CinderVolume deploy cinder-volume on controller node(ceph backend).
// The method takes the following command of Playback:
//  playback --ansible 'openstack_cinder_volume_ceph.yml --extra-vars "host=controller01" -vvvv'
//  playback --ansible 'openstack_cinder_volume_ceph.yml --extra-vars "host=controller02" -vvvv'
// Copy the ceph.client.cinder.keyring from ceph-admin node to /etc/ceph/ceph.client.cinder.keyring of cinder volume nodes and nova-compute nodes to using the ceph client:
//  ceph auth get-or-create client.cinder | ssh [email protected] sudo tee /etc/ceph/ceph.client.cinder.keyring
//  ceph auth get-or-create client.cinder | ssh [email protected] sudo tee /etc/ceph/ceph.client.cinder.keyring
//  ceph auth get-or-create client.cinder | ssh [email protected] sudo tee /etc/ceph/ceph.client.cinder.keyring
//  ceph auth get-or-create client.cinder | ssh [email protected] sudo tee /etc/ceph/ceph.client.cinder.keyring
//  ceph auth get-or-create client.cinder | ssh [email protected] sudo tee /etc/ceph/ceph.client.cinder.keyring
//  ceph auth get-or-create client.cinder | ssh [email protected] sudo tee /etc/ceph/ceph.client.cinder.keyring
//  ceph auth get-or-create client.cinder | ssh [email protected] sudo tee /etc/ceph/ceph.client.cinder.keyring
//  ceph auth get-or-create client.cinder | ssh [email protected] sudo tee /etc/ceph/ceph.client.cinder.keyring
func (vars ExtraVars) CinderVolume() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_cinder_volume_ceph.yml", "--extra-vars", "host="+vars.HostName, "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:17,代码来源:openstack.go


示例18: SwiftProxy

// SwiftProxy deploy Swift proxy HA.
// The method takes the following commands of Playback:
//  playback --ansible 'openstack_swift_proxy.yml --extra-vars "host=controller01" -vvvv'
//  playback --ansible 'openstack_swift_proxy.yml --extra-vars "host=controller02" -vvvv'
func (vars ExtraVars) SwiftProxy() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_proxy.yml", "--extra-vars", "host="+vars.HostName, "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:8,代码来源:openstack.go


示例19: SwiftStorage

// SwiftStorage deploy Swift storage.
// The method takes the following commands of Playback:
//  playback --ansible 'openstack_swift_storage.yml --extra-vars "host=compute05 my_storage_ip=192.168.1.16" -vvvv'
//  playback --ansible 'openstack_swift_storage.yml --extra-vars "host=compute06 my_storage_ip=192.168.1.15" -vvvv'
func (vars ExtraVars) SwiftStorage() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_swift_storage.yml", "--extra-vars", "host="+vars.HostName, "my_storage_ip="+vars.MyStorageIP, "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:8,代码来源:openstack.go


示例20: FormatDiskForSwift

// FormatDiskForSwift formats devices for Swift Storage (sdb1 and sdc1).
// Each of the swift nodes, /dev/sdb1 and /dev/sdc1, must contain a suitable partition table with one partition occupying the entire device.
// Although the Object Storage service supports any file system with extended attributes (xattr), testing and benchmarking indicate the best performance and reliability on XFS.
// The method takes the folowing commands of Playback:
//  playback --ansible 'openstack_storage_partitions.yml --extra-vars "host=compute05" -vvvv'
//  playback --ansible 'openstack_storage_partitions.yml --extra-vars "host=compute06" -vvvv'
func (vars ExtraVars) FormatDiskForSwift() error {
	command.ExecuteWithOutput("playback", "--ansible", "openstack_storage_partitions.yml", "--extra-vars", "host="+vars.HostName, "-vvvv")
	return nil
}
开发者ID:zhangxuekun,项目名称:fastforward,代码行数:10,代码来源:openstack.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang util.MinikubeRunner类代码示例发布时间:2022-05-23
下一篇:
Golang util.GetFuncName函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap