示例#1
0
# design issues that require this should be avoided forever more, and there are few exceptions.  Cobbler
# must operate as normal with the default value for all fields and not choke on the default values.

FIELDS = [
   [ "name","",0,"Name",True,"Ex: Fedora-11-i386",0,"str"],
   ["ctime",0,0,"",False,"",0,"float"],
   ["mtime",0,0,"",False,"",0,"float"],
   [ "uid","",0,"",False,"",0,"str"],
   [ "owners","SETTINGS:default_ownership",0,"Owners",True,"Owners list for authz_ownership (space delimited)",0,"list"],
   [ "kernel",None,0,"Kernel",True,"Absolute path to kernel on filesystem",0,"str"],
   [ "initrd",None,0,"Initrd",True,"Absolute path to kernel on filesystem",0,"str"],
   [ "kernel_options",{},0,"Kernel Options",True,"Ex: selinux=permissive",0,"dict"],
   [ "kernel_options_post",{},0,"Kernel Options (Post Install)",True,"Ex: clocksource=pit noapic",0,"dict"],
   [ "ks_meta",{},0,"Kickstart Metadata",True,"Ex: dog=fang agent=86", 0,"dict"],
   [ "arch",'i386',0,"Architecture",True,"", ['i386','x86_64','ia64','ppc','s390', 'arm'],"str"],
   [ "breed",'redhat',0,"Breed",True,"What is the type of distribution?",utils.get_valid_breeds(),"str"],
   [ "os_version","generic26",0,"OS Version",True,"Needed for some virtualization optimizations",utils.get_valid_os_versions(),"str"],
   [ "source_repos",[],0,"Source Repos", False,"",0,"list"],
   [ "depth",0,0,"Depth",False,"",0,"int"],
   [ "comment","",0,"Comment",True,"Free form text description",0,"str"],
   [ "tree_build_time",0,0,"Tree Build Time",False,"",0,"str"],
   [ "mgmt_classes",[],0,"Management Classes",True,"Management classes for external config management",0,"list"],
   [ "boot_files",{},0,"TFTP Boot Files",True,"Files copied into tftpboot beyond the kernel/initrd",0,"list"],
   [ "fetchable_files",{},0,"Fetchable Files",True,"Templates for tftp or wget",0,"list"],
   [ "template_files",{},0,"Template Files",True,"File mappings for built-in config management",0,"list"],
   [ "redhat_management_key","<<inherit>>",0,"Red Hat Management Key",True,"Registration key for RHN, Spacewalk, or Satellite",0,"str"],
   [ "redhat_management_server", "<<inherit>>",0,"Red Hat Management Server",True,"Address of Spacewalk or Satellite Server",0,"str"]
]

class Distro(item.Item):
示例#2
0
文件: api.py 项目: ciupicri/cobbler
    def __init__(self, is_cobblerd=False):
        """
        Constructor
        """

        # FIXME: this should be switchable through some simple system

        self.__dict__ = BootAPI.__shared_state
        self.perms_ok = False
        if not BootAPI.__has_loaded:

            if os.path.exists("/etc/cobbler/use.couch"):
                 self.use_couch = True
            else:
                 self.use_couch = False

            # NOTE: we do not log all API actions, because
            # a simple CLI invocation may call adds and such
            # to load the config, which would just fill up
            # the logs, so we'll do that logging at CLI
            # level (and remote.py web service level) instead.

            random.seed()
            self.is_cobblerd = is_cobblerd

            try:
                self.logger = clogger.Logger("/var/log/cobbler/cobbler.log")
            except CX:
                # return to CLI/other but perms are not valid
                # perms_ok is False
                return

            # FIXME: conslidate into 1 server instance

            self.selinux_enabled = utils.is_selinux_enabled()
            self.dist = utils.check_dist()
            self.os_version = utils.os_release()

            BootAPI.__has_loaded   = True

            # load the modules first, or nothing else works...
            module_loader.load_modules()

            self._config = config.Config(self)
            self.deserialize()

            # import signatures
            if not utils.load_signatures(self.settings().signature_path):
                return
            else:
                self.log("%d breeds and %d OS versions read from the signature file" % ( \
                         len(utils.get_valid_breeds()), \
                         len(utils.get_valid_os_versions())))

            self.authn = self.get_module_from_file(
                "authentication",
                "module",
                "authn_configfile"
            )
            self.authz  = self.get_module_from_file(
                "authorization",
                "module",
                "authz_allowall"
            )

            # FIXME: pass more loggers around, and also see that those
            # using things via tasks construct their own kickgen/yumgen/
            # pxegen versus reusing this one, which has the wrong logger
            # (most likely) for background tasks.

            self.kickgen = kickgen.KickGen(self._config)
            self.yumgen  = yumgen.YumGen(self._config)
            self.pxegen  = pxegen.PXEGen(self._config, logger=self.logger)
            self.logger.debug("API handle initialized")
            self.perms_ok = True
示例#3
0
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301  USA
"""

import string
import utils
import item
from cexceptions import CX
from utils import _

# this datastructure is described in great detail in item_distro.py -- read the comments there.

FIELDS = [
  ['name', '', 0, "Name", True, "", 0, "str"],
  ['arch', 'i386', 0, "Architecture", True, "", ["i386", "x86_64", "ia64", "s390", "ppc", "ppc64", "arm"], "str"],
  ['breed', 'redhat', 0, "Breed", True, "", utils.get_valid_breeds(), "str"],
  ['comment', '', 0, "Comment", True, "Free form text description", 0, "str"],
  ['ctime', 0, 0, "", False, "", 0, "float"],
  ['mtime', 0, 0, "", False, "", 0, "float"],
  ['file', '', 0, "File", True, "Path to local file or nfs://user@host:path", 0, "str"],
  ['depth', 0, 0, "", False, "", 0, "int"],
  ['image_type', "iso", 0, "Image Type", True, "", ["iso", "direct", "memdisk", "virt-image"], "str"],
  ['network_count', 1, 0, "Virt NICs", True, "", 0, "int"],
  ['os_version', '', 0, "OS Version", True, "ex: rhel4", utils.get_valid_os_versions(), "str"],
  ['owners', "SETTINGS:default_ownership", 0, "Owners", True, "Owners list for authz_ownership (space delimited)", [], "list"],
  ['parent', '', 0, "", False, "", 0, "str"],
  ['kickstart', '', 0, "Kickstart", True, "Path to kickstart/answer file template", 0, "str"],
  ['virt_auto_boot', "SETTINGS:virt_auto_boot", 0, "Virt Auto Boot", True, "Auto boot this VM?", 0, "bool"],
  ['virt_bridge', "SETTINGS:default_virt_bridge", 0, "Virt Bridge", True, "", 0, "str"],
  ['virt_cpus', 1, 0, "Virt CPUs", True, "", 0, "int"],
  ['virt_file_size', "SETTINGS:default_virt_file_size", 0, "Virt File Size (GB)", True, "", 0, "float"],
示例#4
0
# design issues that require this should be avoided forever more, and there are few exceptions.  Cobbler
# must operate as normal with the default value for all fields and not choke on the default values.

FIELDS = [
    ["name", "", 0, "Name", True, "Ex: Fedora-11-i386", 0, "str"],
    ["ctime", 0, 0, "", False, "", 0, "float"],
    ["mtime", 0, 0, "", False, "", 0, "float"],
    ["uid", "", 0, "", False, "", 0, "str"],
    ["owners", "SETTINGS:default_ownership", 0, "Owners", True, "Owners list for authz_ownership (space delimited)", 0, "list"],
    ["kernel", None, 0, "Kernel", True, "Absolute path to kernel on filesystem", 0, "str"],
    ["initrd", None, 0, "Initrd", True, "Absolute path to kernel on filesystem", 0, "str"],
    ["kernel_options", {}, 0, "Kernel Options", True, "Ex: selinux=permissive", 0, "dict"],
    ["kernel_options_post", {}, 0, "Kernel Options (Post Install)", True, "Ex: clocksource=pit noapic", 0, "dict"],
    ["ks_meta", {}, 0, "Kickstart Metadata", True, "Ex: dog=fang agent=86", 0, "dict"],
    ["arch", 'i386', 0, "Architecture", True, "", ['i386', 'x86_64', 'ia64', 'ppc', 'ppc64', 'arm'], "str"],
    ["breed", 'redhat', 0, "Breed", True, "What is the type of distribution?", utils.get_valid_breeds(), "str"],
    ["os_version", "generic26", 0, "OS Version", True, "Needed for some virtualization optimizations", utils.get_valid_os_versions(), "str"],
    ["source_repos", [], 0, "Source Repos", False, "", 0, "list"],
    ["depth", 0, 0, "Depth", False, "", 0, "int"],
    ["comment", "", 0, "Comment", True, "Free form text description", 0, "str"],
    ["tree_build_time", 0, 0, "Tree Build Time", False, "", 0, "str"],
    ["mgmt_classes", [], 0, "Management Classes", True, "Management classes for external config management", 0, "list"],
    ["boot_files", {}, 0, "TFTP Boot Files", True, "Files copied into tftpboot beyond the kernel/initrd", 0, "list"],
    ["fetchable_files", {}, 0, "Fetchable Files", True, "Templates for tftp or wget", 0, "list"],
    ["template_files", {}, 0, "Template Files", True, "File mappings for built-in config management", 0, "list"],
    ["redhat_management_key", "<<inherit>>", 0, "Red Hat Management Key", True, "Registration key for RHN, Spacewalk, or Satellite", 0, "str"],
    ["redhat_management_server", "<<inherit>>", 0, "Red Hat Management Server", True, "Address of Spacewalk or Satellite Server", 0, "str"]
]


class Distro(item.Item):
示例#5
0
文件: api.py 项目: CyaLiven/cobbler
    def __init__(self, is_cobblerd=False):
        """
        Constructor
        """

        # FIXME: this should be switchable through some simple system

        self.__dict__ = BootAPI.__shared_state
        self.perms_ok = False
        if not BootAPI.__has_loaded:

            if os.path.exists("/etc/cobbler/use.couch"):
                 self.use_couch = True
            else:
                 self.use_couch = False

            # NOTE: we do not log all API actions, because
            # a simple CLI invocation may call adds and such
            # to load the config, which would just fill up
            # the logs, so we'll do that logging at CLI
            # level (and remote.py web service level) instead.

            random.seed()
            self.is_cobblerd = is_cobblerd

            try:
                self.logger = clogger.Logger("/var/log/cobbler/cobbler.log")
            except CX:
                # return to CLI/other but perms are not valid
                # perms_ok is False
                return

            # FIXME: conslidate into 1 server instance

            self.selinux_enabled = utils.is_selinux_enabled()
            self.dist = utils.check_dist()
            self.os_version = utils.os_release()

            BootAPI.__has_loaded   = True

            # load the modules first, or nothing else works...
            module_loader.load_modules()

            self._config = config.Config(self)
            self.deserialize()

            # import signatures
            if not utils.load_signatures(self.settings().signature_path):
                return
            else:
                self.log("%d breeds and %d OS versions read from the signature file" % ( \
                         len(utils.get_valid_breeds()), \
                         len(utils.get_valid_os_versions())))

            self.authn = self.get_module_from_file(
                "authentication",
                "module",
                "authn_configfile"
            )
            self.authz  = self.get_module_from_file(
                "authorization",
                "module",
                "authz_allowall"
            )

            # FIXME: pass more loggers around, and also see that those
            # using things via tasks construct their own kickgen/yumgen/
            # pxegen versus reusing this one, which has the wrong logger
            # (most likely) for background tasks.

            self.kickgen = kickgen.KickGen(self._config)
            self.yumgen  = yumgen.YumGen(self._config)
            self.pxegen  = pxegen.PXEGen(self._config, logger=self.logger)
            self.logger.debug("API handle initialized")
            self.perms_ok = True
示例#6
0
 [
     "kernel_options_post", {}, 0, "Kernel Options (Post Install)",
     True, "Ex: clocksource=pit noapic", 0, "dict"
 ],
 [
     "ks_meta", {}, 0, "Kickstart Metadata", True,
     "Ex: dog=fang agent=86", 0, "dict"
 ],
 [
     "arch", 'i386', 0, "Architecture", True, "",
     ['i386', 'x86_64', 'ia64', 'ppc', 'ppc64', 's390', 'arm'], "str"
 ],
 [
     "breed", 'redhat', 0, "Breed", True,
     "What is the type of distribution?",
     utils.get_valid_breeds(), "str"
 ],
 [
     "os_version", "generic26", 0, "OS Version", True,
     "Needed for some virtualization optimizations",
     utils.get_valid_os_versions(), "str"
 ], ["source_repos", [], 0, "Source Repos", False, "", 0, "list"],
 ["depth", 0, 0, "Depth", False, "", 0, "int"],
 [
     "comment", "", 0, "Comment", True, "Free form text description",
     0, "str"
 ], ["tree_build_time", 0, 0, "Tree Build Time", False, "", 0, "str"],
 [
     "mgmt_classes", [], 0, "Management Classes", True,
     "Management classes for external config management", 0, "list"
 ],
示例#7
0
"""

import string
import utils
import item
import time
from cexceptions import *
import codes
from utils import _

# this datastructure is described in great detail in item_distro.py -- read the comments there.

FIELDS = [
    ["name", "", 0, "Name", True, "", 0, "str"],
    ["arch", "i386", 0, "Architecture", True, "", ["i386", "x86_64", "ia64", "s390", "ppc", "ppc64", "arm"], "str"],
    ["breed", "redhat", 0, "Breed", True, "", utils.get_valid_breeds(), "str"],
    ["comment", "", 0, "Comment", True, "Free form text description", 0, "str"],
    ["ctime", 0, 0, "", False, "", 0, "float"],
    ["mtime", 0, 0, "", False, "", 0, "float"],
    ["file", "", 0, "File", True, "Path to local file or nfs://user@host:path", 0, "str"],
    ["depth", 0, 0, "", False, "", 0, "int"],
    [
        "image_type",
        "iso",
        0,
        "Image Type",
        True,
        "",
        ["iso", "direct", "memdisk", "virt-image"],
        "str",
    ],  # FIXME:complete?