本文整理汇总了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;未经允许,请勿转载。 |
请发表评论