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


Python ShellCmdExecutor.execCmd方法代码示例

本文整理汇总了Python中openstack.icehouse.common.Utils.ShellCmdExecutor.execCmd方法的典型用法代码示例。如果您正苦于以下问题:Python ShellCmdExecutor.execCmd方法的具体用法?Python ShellCmdExecutor.execCmd怎么用?Python ShellCmdExecutor.execCmd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openstack.icehouse.common.Utils.ShellCmdExecutor的用法示例。


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

示例1: stopNetworkManager

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def stopNetworkManager():
     stopCmd = "service NetworkManager stop"
     chkconfigOffCmd = "chkconfig NetworkManager off"
     
     ShellCmdExecutor.execCmd(stopCmd)
     ShellCmdExecutor.execCmd(chkconfigOffCmd)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:9,代码来源:controller.py

示例2: install

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def install():
     yumCmd = "yum install openstack-utils -y"
     ShellCmdExecutor.execCmd(yumCmd)
     
     yumCmd = "yum install openstack-selinux -y"
     ShellCmdExecutor.execCmd(yumCmd)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:9,代码来源:controller.py

示例3: createAdminUser

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def createAdminUser():
     ## create admin user
     ShellCmdExecutor.execCmd("keystone user-create --name=admin --pass=123456 [email protected]")
     ShellCmdExecutor.execCmd("keystone role-create --name=admin")
     ShellCmdExecutor.execCmd("keystone tenant-create --name=admin --description=\"Admin Tenant\"")
     ShellCmdExecutor.execCmd("keystone user-role-add --user=admin --tenant=admin --role=admin")
     ShellCmdExecutor.execCmd("keystone user-role-add --user=admin --role=_member_ --tenant=admin")
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:10,代码来源:controller.py

示例4: createDb

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def createDb(user, passwd, db_name):
     listDbCmd = 'mysql -u%s -p%s -e "show databases" | grep %s' % (user, passwd, db_name)
     output, exitcde = ShellCmdExecutor.execCmd(listDbCmd)
     if (db_name not in output) or output == '' or output == None :
         createDbCmd = 'mysql -u%s -p%s -e "create database %s"' % (user, passwd, db_name)
         output, exitcode = ShellCmdExecutor.execCmd(createDbCmd)
         print "output=%s--" % output
     else :
         print "The DB:%s already exists!" % db_name
         pass
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:13,代码来源:controller.py

示例5: configMyConfFile

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def configMyConfFile():
     print 'start to config my.conf file====='
     curDir = os.getcwd()
     print "curDir=%s" % curDir
     curFileName = os.path.basename(curDir)
     mysqlConfDir = os.path.join(curDir.rstrip(curFileName), 'configfile.template', 'controller')
     mysqlConfFilePath = os.path.join(mysqlConfDir, 'my.cnf')
     print 'mysqlConfFilePath=%s' % mysqlConfFilePath
     cpMyCnfCmd = "sudo cp -rf %s /etc/" % mysqlConfFilePath
     ShellCmdExecutor.execCmd(cpMyCnfCmd)
     print 'config done####'
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:14,代码来源:controller.py

示例6: configDB

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def configDB():
     createDbCmd = "CREATE DATABASE nova"
     MySQL.execMySQLCmd(MySQL.USERNAME, MySQL.INIT_PASSWORD, createDbCmd)
     
     grantCmd = "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '123456'"
     MySQL.execMySQLCmd(MySQL.USERNAME, MySQL.INIT_PASSWORD, grantCmd)
     
     grantCmd = "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '123456'"
     MySQL.execMySQLCmd(MySQL.USERNAME, MySQL.INIT_PASSWORD, grantCmd)
     
     #Import db schema to Nova db
     importDBCmd = "su -s /bin/sh -c \"nova-manage db_sync\" nova"
     ShellCmdExecutor.execCmd(importDBCmd)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:16,代码来源:controller.py

示例7: createUserRole

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
    def createUserRole():
        '''
$ keystone endpoint-create --service-id $(keystone service-list | awk '/ network / {print $2}') --publicurl http://controller:9696 --adminurl http://controller:9696 --internalurl http://controller:9696

        '''
        ShellCmdExecutor.execCmd("keystone user-create --name neutron --pass 123456 --email [email protected]")
        ShellCmdExecutor.execCmd("keystone user-role-add --user neutron --tenant service --role admin")
        ShellCmdExecutor.execCmd("keystone service-create --name neutron --type network --description \"OpenStack Networking\"")
        ShellCmdExecutor.execCmd("keystone endpoint-create --service-id $(keystone service-list | awk '/ network / {print $2}') --publicurl http://controller:9696 --adminurl http://controller:9696 --internalurl http://controller:9696")
        pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:12,代码来源:controller.py

示例8: configKeyStone

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def configKeyStone():
     #configure KeyStone to support PKI token
     cmd = "keystone-manage pki_setup --keystone-user keystone --keystone-group keystone"
     ShellCmdExecutor.execCmd(cmd)
     ShellCmdExecutor.execCmd("chown -R keystone:keystone /etc/keystone/ssl")
     ShellCmdExecutor.execCmd("chmod -R o-rwx /etc/keystone/ssl")
     
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:10,代码来源:controller.py

示例9: initRabbitMQ

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def initRabbitMQ(username, password):
     startCmd = "/etc/init.d/rabbitmq-server restart"
     ShellCmdExecutor.execCmd(startCmd)
     
     chkconfigCmd = "chkconfig rabbitmq-server on"
     ShellCmdExecutor.execCmd(chkconfigCmd)
     
     initPasswordCmd = "rabbitmqctl change_password %s %s" % (username, password)
     ShellCmdExecutor.execCmd(initPasswordCmd)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:12,代码来源:controller.py

示例10: initMySQL

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def initMySQL(user, initPasswd):
     #when mysql is installed,config file and the root password is None, init the db.
     MySQL.configMyConfFile()
     
     #start
     startCmd = "service mysql start"
     ShellCmdExecutor.execCmd(startCmd)
     
     #chkcofnig
     chkconfigCmd = "chkconfig mysql on"
     ShellCmdExecutor.execCmd(chkconfigCmd)
     
     initPasswdCmd = 'mysqladmin -u%s password %s' % (user, initPasswd)
     ShellCmdExecutor.execCmd(initPasswdCmd)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:17,代码来源:controller.py

示例11: configToEtcHosts

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def configToEtcHosts(ip, domain):
     output, exitcode = ShellCmdExecutor.execCmd("cat /etc/hosts")
     if domain not in output :
         ShellCmdExecutor.execCmd("echo '%s  %s' >> /etc/hosts" % (ip, domain))
         pass
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:8,代码来源:controller.py

示例12: start

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def start():
     ShellCmdExecutor.execCmd("service httpd restart")
     ShellCmdExecutor.execCmd("service memcached restart")
     ShellCmdExecutor.execCmd("chkconfig httpd on")
     ShellCmdExecutor.execCmd("chkconfig memcached on")
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:8,代码来源:controller.py

示例13: stopIPTables

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def stopIPTables():
     stopCmd = "service iptables stop"
     ShellCmdExecutor.execCmd(stopCmd)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:6,代码来源:controller.py

示例14: restart

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def restart():
     #restart Controller nova-api service
     restartCmd = "service openstack-nova-api restart"
     ShellCmdExecutor.execCmd(restartCmd)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:7,代码来源:controller.py

示例15: configEnvVar

# 需要导入模块: from openstack.icehouse.common.Utils import ShellCmdExecutor [as 别名]
# 或者: from openstack.icehouse.common.Utils.ShellCmdExecutor import execCmd [as 别名]
 def configEnvVar():
     ## configure env var
     ShellCmdExecutor.execCmd("export OS_SERVICE_TOKEN=123456")
     ShellCmdExecutor.execCmd("export OS_SERVICE_ENDPOINT=http://controller:35357/v2.0")
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:7,代码来源:controller.py


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