diff options
Diffstat (limited to 'cobbler')
-rw-r--r-- | cobbler/item_repo.py | 1 | ||||
-rw-r--r-- | cobbler/utils.py | 3 | ||||
-rw-r--r-- | cobbler/webui/CobblerWeb.py | 63 | ||||
-rw-r--r-- | cobbler/webui/master.py | 18 |
4 files changed, 78 insertions, 7 deletions
diff --git a/cobbler/item_repo.py b/cobbler/item_repo.py index 51fe9a7..48fefc5 100644 --- a/cobbler/item_repo.py +++ b/cobbler/item_repo.py @@ -113,6 +113,7 @@ class Repo(item.Item): except: pass self.rpm_list = rpmlist + return True def set_createrepo_flags(self,createrepo_flags): """ diff --git a/cobbler/utils.py b/cobbler/utils.py index 591a7e3..2feee70 100644 --- a/cobbler/utils.py +++ b/cobbler/utils.py @@ -299,12 +299,15 @@ def blender(remove_hashes, root_obj): def flatten(data): # convert certain nested hashes to strings. + # FIXME: this function should be made more generic if data.has_key("kernel_options"): data["kernel_options"] = hash_to_string(data["kernel_options"]) if data.has_key("ks_meta"): data["ks_meta"] = hash_to_string(data["ks_meta"]) if data.has_key("repos") and type(data["repos"]) == list: data["repos"] = " ".join(data["repos"]) + if data.has_key("rpm_list") and type(data["rpm_list"]) == list: + data["rpm_list"] = " ".join(data["rpm_list"]) return data def __consolidate(node,results): diff --git a/cobbler/webui/CobblerWeb.py b/cobbler/webui/CobblerWeb.py index 2466f68..ab7afec 100644 --- a/cobbler/webui/CobblerWeb.py +++ b/cobbler/webui/CobblerWeb.py @@ -346,7 +346,64 @@ class CobblerWeb(object): # Repos # ------------------------------------------------------------------------ # - # integrate repository adding/editing as with the other objects. + def repo_list(self): + self.__xmlrpc_setup() + repos = self.remote.get_repos() + if len(repos) > 0: + return self.__render( 'repo_list.tmpl', { + 'repos': repos + }) + else: + return self.__render('empty.tmpl', {}) + + def repo_edit(self, name=None): + self.__xmlrpc_setup() + + input_repo = None + if name is not None: + input_repo = self.remote.get_repo(name, True) + + return self.__render( 'repo_edit.tmpl', { + 'repo': input_repo, + } ) + + def repo_save(self,name=None,new_or_edit=None,mirror=None,keepupdated=None,localfilename=None,rpmlist=None,createrepoflags=None,**args): + self.__xmlrpc_setup() + + # pre-command parameter checking + if name is None: + return self.error_page("name is required") + if mirror is None: + return self.error_page("mirror is required") + + # grab a reference to the object + if new_or_edit == "edit": + try: + repo = self.remote.get_repo_handle( name, self.token) + except: + return self.error_page("Failed to lookup repo: %s" % name) + else: + repo = self.remote.new_repo(self.token) + + try: + self.remote.modify_repo(repo, 'name', name, self.token) + self.remote.modify_repo(repo, 'mirror', mirror, self.token) + if keepupdated: + self.remote.modify_repo(repo, 'keep-updated', keepupdated, self.token) + if localfilename: + self.remote.modify_repo(repo, 'local-filename', localfilename, self.token) + if rpmlist: + self.remote.modify_repo(repo, 'rpm-list', rpmlist, self.token) + if createrepoflags: + self.remote.modify_distro(repo, 'createrepo-flags', createrepoflags, self.token) + self.remote.save_repo(repo, self.token) + except Exception, e: + log_exc() + return self.error_page("Error while saving repo: %s" % str(e)) + + return self.repo_edit(name=name) + + # ------------------------------------------------------------------------ # # Kickstart files @@ -408,6 +465,10 @@ class CobblerWeb(object): system_list.exposed = True system_save.exposed = True + repo_edit.exposed = True + repo_list.exposed = True + repo_save.exposed = True + settings_view.exposed = True ksfile_view.exposed = True ksfile_list.exposed = True diff --git a/cobbler/webui/master.py b/cobbler/webui/master.py index a9cfdab..1525f4f 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__ = 1189723059.0217919 -__CHEETAH_genTimestamp__ = 'Thu Sep 13 18:37:39 2007' +__CHEETAH_genTime__ = 1189794092.422076 +__CHEETAH_genTimestamp__ = 'Fri Sep 14 14:21:32 2007' __CHEETAH_src__ = 'webui_templates/master.tmpl' -__CHEETAH_srcLastModified__ = 'Thu Sep 13 18:27:46 2007' +__CHEETAH_srcLastModified__ = 'Fri Sep 14 14:19:18 2007' __CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine' if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple: @@ -172,7 +172,10 @@ class master(Template): _v = VFFSL(SL,"base_url",True) # '$base_url' on line 39, col 22 if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 39, col 22. write('''/ksfile_list" class="menu">Kickstarts</a></li> - <li>(Pending: Repos)</li> + <li><a href="''') + _v = VFFSL(SL,"base_url",True) # '$base_url' on line 40, col 22 + if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 40, col 22. + write('''/repo_list" class="menu">Repos</a></li> <li><hr/></li> <li>ADD</li> <li><a href="''') @@ -187,9 +190,12 @@ class master(Template): _v = VFFSL(SL,"base_url",True) # '$base_url' on line 45, col 22 if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 45, col 22. write('''/system_edit" class="menu">System</a></li> - <li>(Pending: Repo)</li> + <li><a href="''') + _v = VFFSL(SL,"base_url",True) # '$base_url' on line 46, col 22 + if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 46, col 22. + write('''/repo_edit" class="menu">Repo</a></li> <li><hr/></li> - <li>Sync</li> + <li><Sync></li> </ul> </div> |