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

Python operating_system.get_os函数代码示例

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

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



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

示例1: test_get_os_debian

 def test_get_os_debian(self):
     with patch.object(os.path, 'isfile', side_effect=[False,
                                                       False,
                                                       False,
                                                       True]):
         find_os = operating_system.get_os()
     self.assertEqual('debian', find_os)
开发者ID:Tesora,项目名称:tesora-trove,代码行数:7,代码来源:test_operating_system.py


示例2: __new__

 def __new__(meta, name, bases, dct):
     if operating_system.get_os() == operating_system.REDHAT:
         bases += (RedhatPackagerMixin, )
     else:
         # The default is debian
         bases += (DebianPackagerMixin,)
     return super(BasePackage, meta).__new__(meta, name, bases, dct)
开发者ID:SlickNik,项目名称:trove-guestagent,代码行数:7,代码来源:pkg.py


示例3: cassandra_conf_dir

 def cassandra_conf_dir(self):
     return {
         operating_system.REDHAT: "/etc/dse/cassandra/",
         operating_system.DEBIAN: "/etc/dse/cassandra/",
         operating_system.SUSE: "/etc/dse/cassandra/",
         operating_system.ORACLE: "/etc/dse/cassandra/"
     }[operating_system.get_os()]
开发者ID:Tesora,项目名称:tesora-trove,代码行数:7,代码来源:service.py


示例4:

ENGINE = None
DATADIR = None
PREPARING = False
UUID = False

TMP_MYCNF = "/tmp/my.cnf.tmp"
MYSQL_BASE_DIR = "/var/lib/mysql"

CONF = cfg.CONF

INCLUDE_MARKER_OPERATORS = {
    True: ">=",
    False: ">"
}

OS_NAME = operating_system.get_os()
MYSQL_CONFIG = {operating_system.REDHAT: "/etc/my.cnf",
                operating_system.DEBIAN: "/etc/mysql/my.cnf",
                operating_system.SUSE: "/etc/my.cnf"}[OS_NAME]
MYSQL_SERVICE_CANDIDATES = ["mysql", "mysqld", "mysql-server"]
MYSQL_BIN_CANDIDATES = ["/usr/sbin/mysqld", "/usr/libexec/mysqld"]
MYSQL_OWNER = 'mysql'
CNF_EXT = 'cnf'
CNF_INCLUDE_DIR = '/etc/mysql/conf.d/'
CNF_MASTER = 'master-replication'
CNF_SLAVE = 'slave-replication'

# Create a package impl
packager = pkg.Package()

开发者ID:zjtheone,项目名称:trove,代码行数:29,代码来源:service.py


示例5: get_os

#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""
Determines operating system version and os depended commands.
"""
from trove.guestagent.common.operating_system import get_os

OS = get_os()
REDIS_CONFIG = '/etc/redis/redis.conf'
REDIS_CONF_DIR = '/etc/redis'
REDIS_INIT = '/etc/init/redis-server.conf'
REDIS_CLI = '/usr/bin/redis-cli'
REDIS_BIN = '/usr/bin/redis-server'
REDIS_CMD_ENABLE = 'update-rc.d redis-server enable'
REDIS_CMD_DISABLE = 'update-rc.d redis-server disable'
REDIS_CMD_START = 'service redis-server start || /bin/true'
REDIS_CMD_STOP = 'service redis-server stop || /bin/true'
REDIS_PACKAGE = 'redis-server'
REDIS_BASE_DIR = '/var/lib/redis'

if OS is 'redhat':
    REDIS_BIN = '/usr/libexec/redis-server'
    REDIS_CMD_ENABLE = 'chkconfig redis-server on'
开发者ID:NeCTAR-RC,项目名称:trove,代码行数:31,代码来源:system.py


示例6: test_get_os_redhat

 def test_get_os_redhat(self):
     with patch.object(os.path, 'isfile', side_effect=[True]):
         find_os = operating_system.get_os()
     self.assertEqual('redhat', find_os)
开发者ID:Tesora,项目名称:tesora-trove,代码行数:4,代码来源:test_operating_system.py


示例7: test_get_os_suse

 def test_get_os_suse(self):
     with patch.object(os.path, "isfile", side_effect=[False, True]):
         find_os = operating_system.get_os()
     self.assertEqual("suse", find_os)
开发者ID:mmasaki,项目名称:trove,代码行数:4,代码来源:test_operating_system.py


示例8: pkg_remove

            if ((package_version and installed_version == package_version) or
               (installed_version and not package_version)):
                LOG.debug("Package %s already installed." % package_name)
            else:
                return False
        return True

    def pkg_remove(self, package_name, time_out):
        """Removes a package."""
        if self.pkg_version(package_name) is None:
            return
        result = self._remove(package_name, time_out)

        if result != OK:
            if result == REINSTALL_FIRST:
                self._install(package_name, time_out)
            elif result == RUN_DPKG_FIRST:
                self._fix(time_out)
            result = self._remove(package_name, time_out)
            if result != OK:
                raise PkgPackageStateError("Package %s is in a bad state."
                                           % package_name)


if operating_system.get_os() == operating_system.REDHAT:
    class Package(RedhatPackagerMixin):
        pass
else:
    class Package(DebianPackagerMixin):
        pass
开发者ID:ISCAS-VDI,项目名称:trove-base,代码行数:30,代码来源:pkg.py


示例9: pkg_remove

               (installed_version and not package_version)):
                LOG.debug("Package %s already installed." % package_name)
            else:
                return False
        return True

    def pkg_remove(self, package_name, time_out):
        """Removes a package."""
        if self.pkg_version(package_name) is None:
            return
        result = self._remove(package_name, time_out)

        if result != OK:
            if result == REINSTALL_FIRST:
                self._install(package_name, time_out)
            elif result == RUN_DPKG_FIRST:
                self._fix(time_out)
            result = self._remove(package_name, time_out)
            if result != OK:
                raise PkgPackageStateError(_("Package %s is in a bad state.")
                                           % package_name)


if operating_system.get_os() in [operating_system.REDHAT,
                                 operating_system.ORACLE]:
    class Package(RedhatPackagerMixin):
        pass
else:
    class Package(DebianPackagerMixin):
        pass
开发者ID:Tesora,项目名称:tesora-trove,代码行数:30,代码来源:pkg.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python operating_system.move函数代码示例发布时间:2022-05-27
下一篇:
Python operating_system.exists函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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