summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--cobbler/item.py2
-rw-r--r--cobbler/item_profile.py37
-rw-r--r--cobbler/remote.py8
-rw-r--r--cobbler/webui/CobblerWeb.py47
-rw-r--r--cobbler/webui/master.py8
-rw-r--r--webui_templates/profile_edit.tmpl6
7 files changed, 76 insertions, 34 deletions
diff --git a/Makefile b/Makefile
index 8f1c482..cb2661a 100644
--- a/Makefile
+++ b/Makefile
@@ -31,8 +31,6 @@ devinstall:
make install
cp /tmp/cobbler_settings /var/lib/cobbler/settings
cp /tmp/cobbler_auth.conf /etc/cobbler/auth.conf
- /sbin/service cobblerd restart
- /sbin/service httpd restart
sdist: clean messages updatewui
python setup.py sdist
diff --git a/cobbler/item.py b/cobbler/item.py
index 75b1389..b2fc61d 100644
--- a/cobbler/item.py
+++ b/cobbler/item.py
@@ -49,7 +49,7 @@ class Item(serializable.Serializable):
self.config = config
self.settings = self.config._settings
self.clear(is_subobject) # reset behavior differs for inheritance cases
- self.parent = None # all objects by default are not subobjects
+ self.parent = '' # all objects by default are not subobjects
self.children = {} # caching for performance reasons, not serialized
diff --git a/cobbler/item_profile.py b/cobbler/item_profile.py
index 363f0de..47750ad 100644
--- a/cobbler/item_profile.py
+++ b/cobbler/item_profile.py
@@ -47,13 +47,14 @@ class Profile(item.Item):
self.virt_path = ("", '<<inherit>>')[is_subobject]
self.virt_bridge = (self.settings.default_virt_bridge, '<<inherit>>')[is_subobject]
self.dhcp_tag = ("default", '<<inherit>>')[is_subobject]
+ self.parent = ''
def from_datastruct(self,seed_data):
"""
Load this object's properties based on seed_data
"""
- self.parent = self.load_item(seed_data,'parent')
+ self.parent = self.load_item(seed_data,'parent','')
self.name = self.load_item(seed_data,'name')
self.distro = self.load_item(seed_data,'distro')
self.kickstart = self.load_item(seed_data,'kickstart')
@@ -66,6 +67,7 @@ class Profile(item.Item):
# backwards compatibility
if type(self.repos) != list:
self.set_repos(self.repos)
+ self.set_parent(self.parent)
# virt specific
self.virt_ram = self.load_item(seed_data,'virt_ram',512)
@@ -96,6 +98,9 @@ class Profile(item.Item):
work. So, API users -- make sure you pass is_subobject=True into the
constructor when using this.
"""
+ if parent_name is None or parent_name == '':
+ self.parent = ''
+ return True
if parent_name == self.name:
# check must be done in two places as set_parent could be called before/after
# set_name...
@@ -105,6 +110,7 @@ class Profile(item.Item):
raise CX(_("profile %s not found, inheritance not possible") % parent_name)
self.parent = parent_name
self.depth = found.depth + 1
+ return True
def set_distro(self,distro_name):
"""
@@ -126,6 +132,7 @@ class Profile(item.Item):
# allow the magic inherit string to persist
if repos == "<<inherit>>":
+ # FIXME: this is not inheritable in the WebUI presently ?
self.repos = "<<inherit>>"
return
@@ -162,6 +169,9 @@ class Profile(item.Item):
Sets the kickstart. This must be a NFS, HTTP, or FTP URL.
Or filesystem path. Minor checking of the URL is performed here.
"""
+ if kickstart == "<<inherit>>":
+ self.kickstart = kickstart
+ return True
if utils.find_kickstart(kickstart):
self.kickstart = kickstart
return True
@@ -174,6 +184,9 @@ class Profile(item.Item):
will not yelp if you try to feed it 9999 CPUs. No formatting
like 9,999 please :)
"""
+ if num == "<<inherit>>":
+ self.virt_cpus = "<<inherit>>"
+ return True
try:
num = int(str(num))
@@ -195,6 +208,10 @@ class Profile(item.Item):
# num is a non-negative integer (0 means default)
# can also be a comma seperated list -- for usage with multiple disks
+ if num == "<<inherit>>":
+ self.virt_file_size = "<<inherit>>"
+ return True
+
if type(num) == str and num.find(",") != -1:
tokens = num.split(",")
for t in tokens:
@@ -221,6 +238,11 @@ class Profile(item.Item):
Specifies the size of the Virt RAM in MB.
0 tells Koan to just choose a reasonable default.
"""
+
+ if num == "<<inherit>>":
+ self.virt_ram = "<<inherit>>"
+ return True
+
# num is a non-negative integer (0 means default)
try:
inum = int(num)
@@ -237,6 +259,11 @@ class Profile(item.Item):
"""
Virtualization preference, can be overridden by koan.
"""
+
+ if vtype == "<<inherit>>":
+ self.virt_type == "<<inherit>>"
+ return True
+
if vtype.lower() not in [ "qemu", "xenpv", "auto" ]:
raise CX(_("invalid virt type"))
self.virt_type = vtype
@@ -314,7 +341,10 @@ class Profile(item.Item):
A human readable representaton
"""
buf = _("profile : %s\n") % self.name
- buf = buf + _("distro : %s\n") % self.distro
+ if self.distro == "<<inherit>>":
+ buf = buf + _("parent : %s\n") % self.parent
+ else:
+ buf = buf + _("distro : %s\n") % self.distro
buf = buf + _("kickstart : %s\n") % self.kickstart
buf = buf + _("kernel options : %s\n") % self.kernel_options
buf = buf + _("ks metadata : %s\n") % self.ks_meta
@@ -331,7 +361,7 @@ class Profile(item.Item):
def remote_methods(self):
return {
'name' : self.set_name,
- 'inherit' : self.set_parent,
+ 'parent' : self.set_parent,
'profile' : self.set_name,
'distro' : self.set_distro,
'kickstart' : self.set_kickstart,
@@ -342,7 +372,6 @@ class Profile(item.Item):
'repos' : self.set_repos,
'virt-path' : self.set_virt_path,
'virt-type' : self.set_virt_type,
- # FIXME: need to add to WUI
'virt-bridge' : self.set_virt_bridge,
'virt-cpus' : self.set_virt_cpus,
'dhcp-tag' : self.set_dhcp_tag
diff --git a/cobbler/remote.py b/cobbler/remote.py
index 6cc16a3..8fb2209 100644
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -478,6 +478,14 @@ class CobblerReadWriteXMLRPCInterface(CobblerXMLRPCInterface):
def new_subprofile(self,token):
"""
+ Creates a new (unconfigured) subprofile object. See the documentation
+ for new_distro as it works exactly the same.
+ """
+ self.__validate_token(token)
+ return self.__store_object(item_profile.Profile(self.api._config, is_subobject=True))
+
+ def new_subprofile(self,token):
+ """
A subprofile is a profile that inherits directly from another profile,
not a distro. In addition to the normal profile setup, setting
the parent variable to the name of an existing profile is also
diff --git a/cobbler/webui/CobblerWeb.py b/cobbler/webui/CobblerWeb.py
index aa5b32c..b16758e 100644
--- a/cobbler/webui/CobblerWeb.py
+++ b/cobbler/webui/CobblerWeb.py
@@ -40,15 +40,15 @@ else:
INVALID_CREDS="Login Required"
def log_exc():
- """
- Log active traceback to logfile.
- """
- if not LOGGING_ENABLED:
- return
- (t, v, tb) = sys.exc_info()
- logger.info("Exception occured: %s" % t )
- logger.info("Exception value: %s" % v)
- logger.info("Exception Info:\n%s" % string.join(traceback.format_list(traceback.extract_tb(tb))))
+ """
+ Log active traceback to logfile.
+ """
+ if not LOGGING_ENABLED:
+ return
+ (t, v, tb) = sys.exc_info()
+ logger.info("Exception occured: %s" % t )
+ logger.info("Exception value: %s" % v)
+ logger.info("Exception Info:\n%s" % string.join(traceback.format_list(traceback.extract_tb(tb))))
class CobblerWeb(object):
"""
@@ -498,7 +498,7 @@ class CobblerWeb(object):
return self.__render('empty.tmpl', {})
def subprofile_edit(self, name=None):
- return self.profile_edit(self,name,subprofile=1)
+ return self.profile_edit(name,1)
def profile_edit(self, name=None, subprofile=0):
@@ -523,7 +523,7 @@ class CobblerWeb(object):
distro=None,kickstart=None,kopts=None,
ksmeta=None,virtfilesize=None,virtram=None,virttype=None,
virtpath=None,repos=None,dhcptag=None,delete1=None,delete2=None,
- parent=None,subprofile=None,**args):
+ parent=None,virtcpus=None,virtbridge=None,subprofile=None,**args):
if not self.__xmlrpc_setup():
return self.login(message=INVALID_CREDS)
@@ -532,9 +532,11 @@ class CobblerWeb(object):
if name is None and editmode=='edit' and oldname is not None:
name = oldname
if name is None:
- return self.error_page("name is required")
- if distro is None:
- return self.error_page("distro is required")
+ return self.error_page("A name has not been specified.")
+ if distro is None and str(subprofile) == "0" :
+ return self.error_page("A distribution has not been specified.")
+ if parent is None and str(subprofile) == "1" :
+ return self.error_page("A parent profile has not been specified.")
if (editmode == 'rename' or editmode == 'copy') and name == oldname:
return self.error_page("The name has not been changed")
@@ -554,15 +556,16 @@ class CobblerWeb(object):
return self.error_page("Failed to lookup profile: %s" % name)
else:
if str(subprofile) != "1":
- profile = self.remote.new_profile(self.token, is_subobject=False)
+ profile = self.remote.new_profile(self.token)
else:
- profile = self.remote.new_profile(self.token, is_subobject=True)
+ profile = self.remote.new_subprofile(self.token)
try:
- self.remote.modify_profile(profile, 'name', name, self.token)
- if str(subprofile) != "1":
+ if name:
+ self.remote.modify_profile(profile, 'name', name, self.token)
+ if str(subprofile) != "1" and distro:
self.remote.modify_profile(profile, 'distro', distro, self.token)
- else:
+ if str(subprofile) == "1" and parent:
self.remote.modify_profile(profile, 'parent', parent, self.token)
if kickstart:
self.remote.modify_profile(profile, 'kickstart', kickstart, self.token)
@@ -578,10 +581,14 @@ class CobblerWeb(object):
self.remote.modify_profile(profile, 'virt-type', virttype, self.token)
if virtpath:
self.remote.modify_profile(profile, 'virt-path', virtpath, self.token)
+ if virtbridge:
+ self.remote.modify_profile(profile, 'virt-bridge', virtbridge, self.token)
+ if virtcpus:
+ self.remote.modify_profile(profile, 'virt-cpus', virtcpus, self.token)
if repos is None:
repos = []
- if type(repos) == type(str()):
+ elif type(repos) == type(str()):
repos = [ repos ]
if type(repos) == type([]):
if '--none--' in repos:
diff --git a/cobbler/webui/master.py b/cobbler/webui/master.py
index 6024e01..a1ea8d2 100644
--- a/cobbler/webui/master.py
+++ b/cobbler/webui/master.py
@@ -33,10 +33,10 @@ VFN=valueForName
currentTime=time.time
__CHEETAH_version__ = '2.0rc8'
__CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 8)
-__CHEETAH_genTime__ = 1192115178.6960659
-__CHEETAH_genTimestamp__ = 'Thu Oct 11 11:06:18 2007'
+__CHEETAH_genTime__ = 1192117907.1724579
+__CHEETAH_genTimestamp__ = 'Thu Oct 11 11:51:47 2007'
__CHEETAH_src__ = 'webui_templates/master.tmpl'
-__CHEETAH_srcLastModified__ = 'Thu Oct 11 10:45:56 2007'
+__CHEETAH_srcLastModified__ = 'Thu Oct 11 11:30:22 2007'
__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
@@ -196,7 +196,7 @@ class master(Template):
<li><a href="''')
_v = VFFSL(SL,"base_url",True) # '$base_url' on line 44, col 26
if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 44, col 26.
- write('''/profile_edit&subprofile=1" class="menu">Subprofile</a></li>
+ write('''/subprofile_edit" class="menu">Subprofile</a></li>
<li><a href="''')
_v = VFFSL(SL,"base_url",True) # '$base_url' on line 45, col 26
if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 45, col 26.
diff --git a/webui_templates/profile_edit.tmpl b/webui_templates/profile_edit.tmpl
index 547ad0d..686bbd6 100644
--- a/webui_templates/profile_edit.tmpl
+++ b/webui_templates/profile_edit.tmpl
@@ -41,7 +41,7 @@ function disablename(value)
#end if
#else
<input type="hidden" name="subprofile" value="$subprofile"/>
- #end
+ #end if
<table border=0>
@@ -112,10 +112,10 @@ function disablename(value)
</option>
#end for
</select>
- <p class="context-tip">What OS is this profile based on?</p>
+ <p class="context-tip">What OS Distribution is this profile based on?</p>
</td>
</tr>
- #end
+ #end if
<!-- should allow freeform input but still show a list of choices? -->
<!-- probably should implement a combo box eventually -->