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


Python ShellCmdExecutor.ShellCmdExecutor类代码示例

本文整理汇总了Python中common.shell.ShellCmdExecutor.ShellCmdExecutor的典型用法代码示例。如果您正苦于以下问题:Python ShellCmdExecutor类的具体用法?Python ShellCmdExecutor怎么用?Python ShellCmdExecutor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: install

 def install():
     print 'NeutronServer.install start===='
     #Install Openstack network services
     yumCmd = "yum install openstack-neutron openstack-neutron-ml2 python-neutronclient which -y"
     ShellCmdExecutor.execCmd(yumCmd)
     print 'NeutronServer.install done####'
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:7,代码来源:neutronserver.py

示例2: stopNetworkManager

 def stopNetworkManager():
     stopCmd = "service NetworkManager stop"
     chkconfigOffCmd = "chkconfig NetworkManager off"
     
     ShellCmdExecutor.execCmd(stopCmd)
     ShellCmdExecutor.execCmd(chkconfigOffCmd)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:7,代码来源:novacompute.py

示例3: initNeutron

 def initNeutron():
     ha_vip1 = JSONUtility.getValue('ha_vip1')
     ha_vip2 = JSONUtility.getValue('ha_vip2')
     
     keystone_admin_password = JSONUtility.getValue('keystone_admin_password')
     keystone_vip = ha_vip1
     keystone_neutron_password = JSONUtility.getValue('keystone_neutron_password')
     neutron_vip = ha_vip1
     
     initNeutronScriptTemplatePath = os.path.join(OPENSTACK_CONF_FILE_TEMPLATE_DIR, 'neutron-server', 'initNeutron.sh')
     ##
     openstackConfPopertiesFilePath = PropertiesUtility.getOpenstackConfPropertiesFilePath()
     openstackScriptDirPath = PropertiesUtility.getValue(openstackConfPopertiesFilePath, 'OPENSTACK_SCRIPT_DIR')
     if os.path.exists(openstackScriptDirPath) :
         os.system('mkdir -p %s' % openstackScriptDirPath)
         pass
     
     ShellCmdExecutor.execCmd('cp -r %s %s' % (initNeutronScriptTemplatePath, openstackScriptDirPath))
     
     initNeutronScriptPath = os.path.join(openstackScriptDirPath, 'initNeutron.sh')
     FileUtil.replaceFileContent(initNeutronScriptPath, '<KEYSTONE_ADMIN_PASSWORD>', keystone_admin_password)
     FileUtil.replaceFileContent(initNeutronScriptPath, '<KEYSTONE_VIP>', keystone_vip)
     FileUtil.replaceFileContent(initNeutronScriptPath, '<KEYSTONE_NEUTRON_PASSWORD>', keystone_neutron_password)
     FileUtil.replaceFileContent(initNeutronScriptPath, '<NEUTRON_VIP>', neutron_vip)
     ShellCmdExecutor.execCmd('bash %s' % initNeutronScriptPath)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:26,代码来源:initKeystone.py

示例4: configConfFile

 def configConfFile():
     NeutronServer.configNeutronConfFile()
     
     NeutronServer.configML2()
     
     ShellCmdExecutor.execCmd('ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini')
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:7,代码来源:neutronserver.py

示例5: start

    def start():
        if debug == True :
            pass
        else :
            dashboard_vip_interface = JSONUtility.getValue("dashboard_vip_interface")
            dashboard_vip = JSONUtility.getValue("dashboard_vip")
            
            DashboardHA.addVIP(dashboard_vip, dashboard_vip_interface)
            
            if DashboardHA.isHAProxyRunning() :
                ShellCmdExecutor.execCmd('service haproxy restart')
            else :
                ShellCmdExecutor.execCmd('service haproxy start')
                pass
            
#             DashboardHA.deleteVIP(dashboard_vip, dashboard_vip_interface)
            
            if DashboardHA.isKeepalivedRunning() :
                ShellCmdExecutor.execCmd('service keepalived restart')
            else :
                ShellCmdExecutor.execCmd('service keepalived start')
                pass
            
            #Ensure only one VIP exists.
            isMasterNode = DashboardHA.isMasterNode()
            if isMasterNode == True :
                DashboardHA.restart()
                pass
            else :
                DashboardHA.deleteVIP(dashboard_vip, dashboard_vip_interface)
                pass
            pass
        ShellCmdExecutor.execCmd('service keepalived restart')
        pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:34,代码来源:dashboard.py

示例6: install

 def install():
     if debug == True :
         print "DEBUG is True.On local dev env, do test==="
         yumCmd = "ls -lt"
         ShellCmdExecutor.execCmd(yumCmd)
         pass
     else :
         if not NovaHA.isKeepalivedInstalled() :
             keepalivedInstallCmd = "yum install keepalived -y"
             ShellCmdExecutor.execCmd(keepalivedInstallCmd)
             pass
         
         if not NovaHA.isHAProxyInstalled() :
             haproxyInstallCmd = 'yum install haproxy -y'
             ShellCmdExecutor.execCmd(haproxyInstallCmd)
             
             #prepare haproxy conf file template
             openstackConfPopertiesFilePath = PropertiesUtility.getOpenstackConfPropertiesFilePath()
             haproxyTemplateFilePath = os.path.join(OPENSTACK_CONF_FILE_TEMPLATE_DIR, 'haproxy.cfg')
             haproxyConfFilePath = PropertiesUtility.getValue(openstackConfPopertiesFilePath, 'HAPROXY_CONF_FILE_PATH')
             print 'haproxyTemplateFilePath=%s' % haproxyTemplateFilePath
             print 'haproxyConfFilePath=%s' % haproxyConfFilePath
             if not os.path.exists('/etc/haproxy') :
                 ShellCmdExecutor.execCmd('sudo mkdir /etc/haproxy')
                 pass
             
             ShellCmdExecutor.execCmd('sudo cp -r %s %s' % (haproxyTemplateFilePath, '/etc/haproxy'))
             pass
         pass
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:30,代码来源:nova.py

示例7: configureEnvVar

 def configureEnvVar():
     ShellCmdExecutor.execCmd('export OS_SERVICE_TOKEN=123456')
     template_string = 'export OS_SERVICE_ENDPOINT=http://<KEYSTONE_VIP>:35357/v2.0'
     keystone_vip = JSONUtility.getValue('keystone_vip')
     cmd = template_string.replace('<KEYSTONE_VIP>', keystone_vip)
     ShellCmdExecutor.execCmd(cmd)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:7,代码来源:MySQLHA.py

示例8: install

    def install():
        #KEYSTONE_ADMIN_PASSWORD
        print 'Cinder-storage.install start===='
        #
        keystone_vip = JSONUtility.getValue('keystone_vip')
        keystone_admin_password = JSONUtility.getValue('keystone_admin_password')
        print 'start to install prerequisites============='
        script_file_path = os.path.join(OPENSTACK_CONF_FILE_TEMPLATE_DIR, 
                                                      'cinder-storage', 
                                                      'cinder_storage_service.sh')
        
        ShellCmdExecutor.execCmd('cp -r %s /opt/' % script_file_path)
        ShellCmdExecutor.execCmd('chmod 777 /opt/cinder_storage_service.sh')
        FileUtil.replaceFileContent('/opt/cinder_storage_service.sh', '<KEYSTONE_VIP>', keystone_vip)
        ShellCmdExecutor.execCmd('bash /opt/cinder_storage_service.sh')
        
        
        ShellCmdExecutor.execCmd("systemctl restart lvm2-lvmetad.service")
        
        #Default create volume
        #Create the LVM physical volume /dev/sdb1:
#         createCmd = 'pvcreate /dev/sdb1' 
#         ShellCmdExecutor.execCmd(createCmd)
        
#         createCmd = 'vgcreate cinder-volumes /dev/sdb1'
#         ShellCmdExecutor.execCmd(createCmd)
       
        yumCmd = 'yum install openstack-cinder targetcli python-oslo-db python-oslo-log MySQL-python -y'
        ShellCmdExecutor.execCmd(yumCmd)
        
        print 'Cinder-storage.install done####'
        pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:32,代码来源:cinderstorage.py

示例9: start

 def start():
     if debug == True :
         pass
     else :
         nova_vip_interface = JSONUtility.getValue("nova_vip_interface")
         nova_vip = JSONUtility.getValue("nova_vip")
         
         NovaHA.addVIP(nova_vip, nova_vip_interface)
         
         if NovaHA.isHAProxyRunning() :
             ShellCmdExecutor.execCmd('service haproxy restart')
         else :
             ShellCmdExecutor.execCmd('service haproxy start')
             pass
         
         if NovaHA.isKeepalivedRunning() :
             ShellCmdExecutor.execCmd('service keepalived restart')
         else :
             ShellCmdExecutor.execCmd('service keepalived start')
             pass
         
         #Ensure only one VIP exists.
         isMasterNode = NovaHA.isMasterNode()
         if isMasterNode == True :
             NovaHA.restart()
         else :
             NovaHA.deleteVIP(nova_vip, nova_vip_interface)
         pass
     ShellCmdExecutor.execCmd('service keepalived restart')
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:30,代码来源:nova.py

示例10: start

 def start():
     if debug == True :
         pass
     else :
         neutron_vip_interface = JSONUtility.getValue("neutron_vip_interface")
         neutron_vip = JSONUtility.getValue("neutron_vip")
         
         NeutronServerHA.addVIP(neutron_vip, neutron_vip_interface)
         
         if NeutronServerHA.isHAProxyRunning() :
             ShellCmdExecutor.execCmd('service haproxy restart')
         else :
             ShellCmdExecutor.execCmd('service haproxy start')
             pass
         
         if NeutronServerHA.isKeepalivedRunning() :
             ShellCmdExecutor.execCmd('service keepalived restart')
         else :
             ShellCmdExecutor.execCmd('service keepalived start')
             pass
         
         isMasterNode = NeutronServerHA.isMasterNode()
         if isMasterNode == True :
             NeutronServerHA.restart()
             pass
         else :
             NeutronServerHA.deleteVIP(neutron_vip, neutron_vip_interface)
             pass
         pass
     ShellCmdExecutor.execCmd('service keepalived restart')
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:31,代码来源:neutronserver.py

示例11: start

    def start():
        if debug == True :
            pass
        else :
            keystone_vip_interface = JSONUtility.getValue("keystone_vip_interface")
            keystone_vip = JSONUtility.getValue("keystone_vip")
            
            KeystoneHA.addVIP(keystone_vip, keystone_vip_interface)
            
            if KeystoneHA.isHAProxyRunning() :
                ShellCmdExecutor.execCmd('service haproxy restart')
            else :
                ShellCmdExecutor.execCmd('service haproxy start')
                pass
            
#             KeystoneHA.deleteVIP(keystone_vip, keystone_vip_interface)
            
            if KeystoneHA.isKeepalivedRunning() :
                ShellCmdExecutor.execCmd('service keepalived restart')
            else :
                ShellCmdExecutor.execCmd('service keepalived start')
                pass
            
            isMasterNode = KeystoneHA.isMasterNode()
            if isMasterNode == True :
                KeystoneHA.restart()
                pass
            else :
                KeystoneHA.deleteVIP(keystone_vip, keystone_vip_interface)
                pass
            pass
        ShellCmdExecutor.execCmd('service keepalived restart')
        pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:33,代码来源:keystone.py

示例12: importKeystoneDBSchema

 def importKeystoneDBSchema():
     #Before import,detect the database rights for mysql user keystone.
     
     ##
     importCmd = 'su -s /bin/sh -c "keystone-manage db_sync" keystone'
     ShellCmdExecutor.execCmd(importCmd)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:7,代码来源:keystone.py

示例13: installWSGI

 def installWSGI():
     ShellCmdExecutor.execCmd('mkdir -p /var/www/cgi-bin/keystone')
     main_python_file_path = os.path.join(OPENSTACK_CONF_FILE_TEMPLATE_DIR, 'keystone', 'main')
     ShellCmdExecutor.execCmd('cp -r %s /var/www/cgi-bin/keystone' % main_python_file_path)
     ShellCmdExecutor.execCmd('cp /var/www/cgi-bin/keystone/main /var/www/cgi-bin/keystone/admin')
     ShellCmdExecutor.execCmd('chown -R keystone:keystone /var/www/cgi-bin/keystone')
     ShellCmdExecutor.execCmd('chmod 755 /var/www/cgi-bin/keystone/*')
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:8,代码来源:keystone.py

示例14: install

 def install():
     print "Nova.install start===="
     yumCmd = "yum install openstack-nova-api openstack-nova-cert openstack-nova-conductor \
     openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler \
     python-novaclient -y"
     ShellCmdExecutor.execCmd(yumCmd)
     print "Nova.install done####"
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:8,代码来源:nova.py

示例15: install

    def install():
        print 'Network.install start===='
        #Install Openstack network services
        yumCmd = "yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch -y"
        ShellCmdExecutor.execCmd(yumCmd)
#         Network.configConfFile()
        print 'Network.install done####'
        pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:8,代码来源:network.py


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