2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
26 """Check_MK's library for code used by different components of Check_MK.
28 This library is currently handled as internal module of Check_MK and
29 does not offer stable APIs. The code may change at any time."""
31 __version__
= "1.6.0i1"
35 import cmk
.utils
.paths
36 from cmk
.utils
.exceptions
import MKGeneralException
37 from cmk
.utils
.i18n
import _
41 return os
.path
.basename(os
.readlink(cmk
.utils
.paths
.omd_root
+ "/version"))
46 return os
.environ
["OMD_SITE"]
48 raise MKGeneralException(
49 _("OMD_SITE environment variable not set. You can "
50 "only execute this in an OMD site."))
54 """Can currently either return \"cre\" or \"cee\"."""
55 parts
= omd_version().split(".")
56 if parts
[-1] == "demo":
62 def is_enterprise_edition():
63 return edition_short() == "cee"
67 return edition_short() == "cre"
70 def is_managed_edition():
71 return edition_short() == "cme"
75 parts
= omd_version().split(".")
76 return parts
[-1] == "demo"