summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cobbler/webui/CobblerWeb.py19
-rw-r--r--cobbler/webui/master.py11
-rw-r--r--docs/WUI_TODO3
-rw-r--r--setup.py1
-rw-r--r--webui_templates/login.tmpl28
-rw-r--r--webui_templates/master.tmpl2
-rw-r--r--webui_templates/message.tmpl13
7 files changed, 69 insertions, 8 deletions
diff --git a/cobbler/webui/CobblerWeb.py b/cobbler/webui/CobblerWeb.py
index fec69dbf..a5e9d308 100644
--- a/cobbler/webui/CobblerWeb.py
+++ b/cobbler/webui/CobblerWeb.py
@@ -627,6 +627,23 @@ class CobblerWeb(object):
# ------------------------------------------------------------------------ #
# Miscellaneous
# ------------------------------------------------------------------------ #
+
+ def sync(self):
+ if not self.__xmlrpc_setup():
+ return self.login(message="")
+
+ try:
+ rc = self.remote.sync(self.token)
+ if not rc:
+ return self.error_page("Sync failed. Try debugging locally.")
+ except Exception, e:
+ log_exc()
+ return self.error_page("Sync encountered an exception: %s" % str(e))
+
+ return self.__render('message.tmpl', {
+ 'message1' : "Sync complete.",
+ 'message2' : "Cobbler config has been applied to filesystem."
+ })
def error_page(self, message):
return self.__render( 'error_page.tmpl', {
@@ -667,6 +684,8 @@ class CobblerWeb(object):
ksfile_save.exposed = True
ksfile_list.exposed = True
+ sync.exposed = True
+
class CobblerWebAuthException(exceptions.Exception):
pass
diff --git a/cobbler/webui/master.py b/cobbler/webui/master.py
index 017da01a..0ccdc819 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__ = 1189812484.1640699
-__CHEETAH_genTimestamp__ = 'Fri Sep 14 16:28:04 2007'
+__CHEETAH_genTime__ = 1190142943.107908
+__CHEETAH_genTimestamp__ = 'Tue Sep 18 15:15:43 2007'
__CHEETAH_src__ = 'webui_templates/master.tmpl'
-__CHEETAH_srcLastModified__ = 'Fri Sep 14 16:27:47 2007'
+__CHEETAH_srcLastModified__ = 'Tue Sep 18 15:11:43 2007'
__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
@@ -205,7 +205,10 @@ class master(Template):
''')
write(''' <li><hr/></li>
''')
- write(''' <li>&lt;Sync&gt;</li>
+ write(''' <li><a href="''')
+ _v = VFFSL(SL,"base_url",True) # '$base_url' on line 50, col 21
+ if _v is not None: write(_filter(_v, rawExpr='$base_url')) # from line 50, col 21.
+ write('''/sync" class="menu">Sync</A></li>
</ul>
</div>
diff --git a/docs/WUI_TODO b/docs/WUI_TODO
index ae6dfaf0..c4aa40d2 100644
--- a/docs/WUI_TODO
+++ b/docs/WUI_TODO
@@ -2,10 +2,7 @@ Things to do on the Web User Interface
- make fields wider that need to be wider (most can probably be ~128? Ksmeta/Kopts min 255)
- modify form fields that should be radio boxes, etc (things like arch, breed)
-- rename (and/or copy?) support for all distro, profile, system, repo objects
- -- just detect when name changes, should not require a new form
- kickstart file editing and new kickstart file creation (if in /var/lib/cobbler/kickstarts)
-- sync button -- hook up to API.
- ???
- quick docs for Wiki
- testing
diff --git a/setup.py b/setup.py
index 032a206c..d2b8e611 100644
--- a/setup.py
+++ b/setup.py
@@ -131,6 +131,7 @@ if __name__ == "__main__":
(wwwtmpl, ['webui_templates/repo_edit.tmpl']),
# Web UI common templates
+ (wwwtmpl, ['webui_templates/message.tmpl']),
(wwwtmpl, ['webui_templates/error_page.tmpl']),
(wwwtmpl, ['webui_templates/master.tmpl']),
(wwwtmpl, ['webui_templates/item.tmpl']),
diff --git a/webui_templates/login.tmpl b/webui_templates/login.tmpl
new file mode 100644
index 00000000..bd3cf399
--- /dev/null
+++ b/webui_templates/login.tmpl
@@ -0,0 +1,28 @@
+#extends cobbler.webui.master
+
+#block body
+<form method="post" action="$base_url/login_submit">
+
+#if $message
+ <h1>$message</h1>
+#end if
+
+<fieldset id="login">
+ <legend>Log In</legend>
+
+ <label for="username">Username:</label>
+ <input type="text" id="username" name="username" style="width: 150px;" value="" size="16"/>
+
+ <br/>
+
+ <label for="password">Password:</label>
+ <input type="password" id="password" name="password" style="width: 150px;" value="" size="16"/>
+
+ <br/>
+
+ <input type="submit" name="submit" value="Login"/>
+
+</fieldset>
+</form>
+#end block body
+
diff --git a/webui_templates/master.tmpl b/webui_templates/master.tmpl
index 54f74696..0c3640ca 100644
--- a/webui_templates/master.tmpl
+++ b/webui_templates/master.tmpl
@@ -47,7 +47,7 @@
#end if
<li><hr/></li>
#end if
- <li>&lt;Sync&gt;</li>
+ <li><a href="$base_url/sync" class="menu">Sync</A></li>
</ul>
</div>
diff --git a/webui_templates/message.tmpl b/webui_templates/message.tmpl
new file mode 100644
index 00000000..45d2b4ad
--- /dev/null
+++ b/webui_templates/message.tmpl
@@ -0,0 +1,13 @@
+#extends cobbler.webui.master
+
+#block body
+
+$message1
+
+<br/>
+<br/>
+
+$message2
+
+#end block body
+