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


Python ShellCmdExecutor.ShellCmdExecutor类代码示例

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

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


示例16: configureML2

 def configureML2():
     ml2ConfTemplatePath = os.path.join(OPENSTACK_CONF_FILE_TEMPLATE_DIR, 'nova-compute', 'ml2_conf.ini')
     ShellCmdExecutor.execCmd('cp -r %s /etc/neutron/plugins/ml2/' % ml2ConfTemplatePath)
     
     output, exitcode = ShellCmdExecutor.execCmd('cat /opt/localip')
     localIP = output.strip()
     FileUtil.replaceFileContent('/etc/neutron/plugins/ml2/ml2_conf.ini', '<INSTANCE_TUNNELS_INTERFACE_IP_ADDRESS>', localIP)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:8,代码来源:configureNovaComputeAfterNeutron.py


示例17: restart

    def restart():
#         ShellCmdExecutor.execCmd('/etc/init.d/lvm2-lvmetad restart')
#         ShellCmdExecutor.execCmd('/etc/init.d/tgtd restart')
#         ShellCmdExecutor.execCmd("service openstack-cinder-volume restart")
        initCinderVolumeStorageFilePath = os.path.join(OPENSTACK_CONF_FILE_TEMPLATE_DIR, 'cinder-storage', 'init_cinder_storage_service.sh')
        print 'initCinderVolumeStorageFilePath=%s---' % initCinderVolumeStorageFilePath
        ShellCmdExecutor.execCmd("bash %s" % initCinderVolumeStorageFilePath)
        pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:8,代码来源:cinderstorage.py


示例18: configML2

 def configML2():
     if os.path.exists(NeutronServer.NEUTRON_ML2_CONF_FILE_PATH) :
         ShellCmdExecutor.execCmd('rm -rf %s' % NeutronServer.NEUTRON_ML2_CONF_FILE_PATH)
         pass
     
     NEUTRON_ML2_CONF_DIR = '/etc/neutron/plugins/ml2/'
     neutron_server_ml2_template_file_path = os.path.join(OPENSTACK_CONF_FILE_TEMPLATE_DIR, 'neutron-server', 'ml2_conf.ini')
     ShellCmdExecutor.execCmd('cp -r %s %s' % (neutron_server_ml2_template_file_path, NEUTRON_ML2_CONF_DIR))
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:9,代码来源:neutronserver.py


示例19: install

   def install():
       print 'Ceilometer.install start===='
       yumCmd = 'yum install openstack-ceilometer-api openstack-ceilometer-collector \
 openstack-ceilometer-notification openstack-ceilometer-central openstack-ceilometer-alarm \
 python-ceilometerclient -y'
 
       ShellCmdExecutor.execCmd(yumCmd)
       print 'Ceilometer.install done####'
       pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:9,代码来源:ceilometer.py


示例20: prepareAdminOpenrc

 def prepareAdminOpenrc():
     adminOpenrcTemplateFilePath = os.path.join(OPENSTACK_CONF_FILE_TEMPLATE_DIR, 'admin-openrc.sh')
     ShellCmdExecutor.execCmd('cp -r %s /opt/openstack_conf' % adminOpenrcTemplateFilePath)
     
     keystone_admin_password = JSONUtility.getValue('keystone_admin_password')
     keystone_vip = JSONUtility.getValue('keystone_vip')
     FileUtil.replaceFileContent('/opt/openstack_conf/admin-openrc.sh', '<KEYSTONE_ADMIN_PASSWORD>', keystone_admin_password)
     FileUtil.replaceFileContent('/opt/openstack_conf/admin-openrc.sh', '<KEYSTONE_VIP>', keystone_vip)
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:9,代码来源:adminopenrc.py


示例21: configureDashboardRights

 def configureDashboardRights():
     if os.path.exists("/var/lib/openstack-dashboard") :
         ShellCmdExecutor.execCmd("chmod 777 /var/lib/openstack-dashboard")
         pass
     
     if os.path.exists("/usr/share/openstack-dashboard/openstack_dashboard/local") :
         ShellCmdExecutor.execCmd("chmod 777 /usr/share/openstack-dashboard/openstack_dashboard/local")
         pass
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:9,代码来源:dashboard.py


示例22: install

 def install():
     print 'Nova.install on compute node start========'
     yumCmd = "yum install openstack-nova-compute -y"
     ShellCmdExecutor.execCmd(yumCmd)
     Nova.configConfFile()
     Nova.start()
     
     Nova.configAfterNetworkNodeConfiguration()
     print 'Nova.install on compute node done####'
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:10,代码来源:compute.py


示例23: start

 def start():
     print "start keystone========="
     if debug == True :
         print 'DEBUG=True.On local dev env, do test===='
         pass
     else :
         ShellCmdExecutor.execCmd('service openstack-keystone start')
         ShellCmdExecutor.execCmd('chkconfig openstack-keystone on')
     print "start keystone done####"
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:10,代码来源:MySQLHA.py


示例24: restart

    def restart():
        # support vxlan network mode
        if VXLANConfig.isNeutronServerRole():
            ShellCmdExecutor.execCmd("/etc/init.d/neutron-server restart")
            pass

        if VXLANConfig.isNovaComputeRole() or VXLANConfig.isNeutronAgentRole():
            ShellCmdExecutor.execCmd("/etc/init.d/neutron-openvswitch-agent restart")
            pass
        pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:10,代码来源:vxlanconfig.py


示例25: install

 def install():
     print 'NeutronServer.install start===='
     #Install Openstack network services
     yumCmd = "yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-openvswitch python-neutronclient which -y"
     ShellCmdExecutor.execCmd(yumCmd)
     
     NeutronServer.configConfFile()
     #On Controller node, do Nova.configAfterNetworkNodeConfiguration(), Nova.restart()
     print 'NeutronServer.install done####'
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:10,代码来源:network_bak.py


示例26: sourceAdminOpenRC

 def sourceAdminOpenRC():
     adminOpenRCScriptPath = os.path.join(OPENSTACK_CONF_FILE_TEMPLATE_DIR, 'admin_openrc.sh')
     print 'adminOpenRCScriptPath=%s' % adminOpenRCScriptPath
     
     ShellCmdExecutor.execCmd('cp -rf %s /opt/' % adminOpenRCScriptPath)
     
     keystone_vip = JSONUtility.getValue("keystone_vip")
     FileUtil.replaceFileContent('/opt/admin_openrc.sh', '<KEYSTONE_VIP>', keystone_vip)
     time.sleep(2)
     ShellCmdExecutor.execCmd('source /opt/admin_openrc.sh')
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:11,代码来源:MySQLHA.py


示例27: deleteVIP

 def deleteVIP(vip, interface):
     result = NovaHA.getVIPFormatString(vip, interface)
     print 'result===%s--' % result
     if NovaHA.isExistVIP(vip, interface) :
         deleteVIPCmd = 'ip addr delete {format_vip} dev {interface}'.format(format_vip=result, interface=interface)
         print 'deleteVIPCmd=%s--' % deleteVIPCmd
         ShellCmdExecutor.execCmd(deleteVIPCmd)
         pass
     else :
         print 'The VIP %s does not exist on interface %s.' % (vip, interface)
         pass
     pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:12,代码来源:nova.py


示例28: configSysCtlConfFile

    def configSysCtlConfFile():
        #Use sysctl conf file template to replace original conf file
        '''
1.modify sysctl.conf
net.ipv4.ip_forward=1
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.default.rp_filter=0
        '''
        
        #reload sys configuration
        ShellCmdExecutor.execCmd("sysctl -p")
        pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:12,代码来源:network_bak.py


示例29: configure

    def configure():
        Dashboard.configConfFile()
        
        #assign network connect
        ShellCmdExecutor.execCmd("setsebool -P httpd_can_network_connect on")
        
        #Due to a packaging bug, the dashboard CSS fails to load properly. 
        #Run the following command to resolve this issue:
        ShellCmdExecutor.execCmd("chown -R apache:apache /usr/share/openstack-dashboard/static")
        
#         Dashboard.configHttpdConfFile()
        pass
开发者ID:zbwzy,项目名称:fuel-python,代码行数:12,代码来源:dashboard.py


示例30: getMeteringSecret

 def getMeteringSecret():
     if not os.path.exists(Ceilometer.METERING_SECRET_FILE_PATH) :
         output, exitcode = ShellCmdExecutor.execCmd("openssl rand -hex 10")
         meteringSecret = output.strip()
         FileUtil.writeContent(Ceilometer.METERING_SECRET_FILE_PATH, meteringSecret)
         pass
     
     output, exitcode = ShellCmdExecutor.execCmd('cat %s' % Ceilometer.METERING_SECRET_FILE_PATH)
     
     meteringSecret = output.strip()
     
     return meteringSecret
开发者ID:zbwzy,项目名称:fuel-python,代码行数:12,代码来源:ceilometer.py



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