java/buildconf/apidoc/html/scripts.txt | 27 +++++++++++++
java/buildconf/apidoc/jsp/scripts.txt | 54 +++++++++++++++++++++++++++
java/buildconf/apidoc/singlepage/scripts.txt | 27 +++++++++++++
3 files changed, 108 insertions(+)
New commits:
commit 51ec0b5482c036a61dc444d360da4505859d4284
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Dec 7 11:35:19 2010 +0100
add example of usage of DateTime in python API scripts
This is FAQ, ideally we should add it to Perl as well, but Perl
coders are either smart or no one use Perl. But anyway no one ever
asked how to use date in Perl API scripts.
diff --git a/java/buildconf/apidoc/html/scripts.txt
b/java/buildconf/apidoc/html/scripts.txt
index bd5fdac..56550a9 100644
--- a/java/buildconf/apidoc/html/scripts.txt
+++ b/java/buildconf/apidoc/html/scripts.txt
@@ -51,6 +51,33 @@ for user in list:<br />
<br />
client.auth.logout(key)<br />
</code>
+<p />
+Following code show how to use date-time parameters. This code will schedule
+immediatelly installation of package rhnlib-2.5.22.9.el6.noarch to system with
+id 1000000001.
+<p />
+
+<code>
+#!/usr/bin/python<br />
+from datetime import datetime<br />
+import time<br />
+import xmlrpclib<br />
+<br />
+SATELLITE_URL = "http://satellite.example.com/rpc/api"<br />
+SATELLITE_LOGIN = "username"<br />
+SATELLITE_PASSWORD = "password"<br />
+<br />
+client = xmlrpclib.Server(SATELLITE_URL, verbose=0)<br />
+<br />
+key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)<br />
+package_list = client.packages.findByNvrea(key, 'rhnlib', '2.5.22',
'9.el6', '', 'noarch')<br />
+today = datetime.today()<br />
+earliest_occurrence = xmlrpclib.DateTime(today)<br />
+client.system.schedulePackageInstall(key, 1000000001, package_list[0]['id'],
+earliest_occurrence)<br />
+<br />
+client.auth.logout(key)<br />
+</code>
<hr />
For more examples visit the <a
href="https://fedorahosted.org/spacewalk/">Spacewalk community
page</a>.
diff --git a/java/buildconf/apidoc/jsp/scripts.txt
b/java/buildconf/apidoc/jsp/scripts.txt
index 59baf14..0ec0a01 100644
--- a/java/buildconf/apidoc/jsp/scripts.txt
+++ b/java/buildconf/apidoc/jsp/scripts.txt
@@ -56,6 +56,60 @@ for user in list:<br />
<br />
client.auth.logout(key)<br />
</code>
+<p />
+Following code show how to use date-time parameters. This code will schedule
+immediatelly installation of package rhnlib-2.5.22.9.el6.noarch to system with
+id 1000000001.
+<p />
+
+<code>
+#!/usr/bin/python<br />
+from datetime import datetime<br />
+import time<br />
+import xmlrpclib<br />
+<br />
+SATELLITE_URL = "http://satellite.example.com/rpc/api"<br />
+SATELLITE_LOGIN = "username"<br />
+SATELLITE_PASSWORD = "password"<br />
+<br />
+client = xmlrpclib.Server(SATELLITE_URL, verbose=0)<br />
+<br />
+key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)<br />
+package_list = client.packages.findByNvrea(key, 'rhnlib', '2.5.22',
'9.el6', '', 'noarch')<br />
+today = datetime.today()<br />
+earliest_occurrence = xmlrpclib.DateTime(today)<br />
+client.system.schedulePackageInstall(key, 1000000001, package_list[0]['id'],
+earliest_occurrence)<br />
+<br />
+client.auth.logout(key)<br />
+</code>
+<p />
+Following code show how to use date-time parameters. This code will schedule
+immediatelly installation of package rhnlib-2.5.22.9.el6.noarch to system with
+id 1000000001.
+<p />
+
+<code>
+#!/usr/bin/python<br />
+from datetime import datetime<br />
+import time<br />
+import xmlrpclib<br />
+<br />
+SATELLITE_URL = "http://satellite.example.com/rpc/api"<br />
+SATELLITE_LOGIN = "username"<br />
+SATELLITE_PASSWORD = "password"<br />
+<br />
+client = xmlrpclib.Server(SATELLITE_URL, verbose=0)<br />
+<br />
+key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)<br />
+package_list = client.packages.findByNvrea(key, 'rhnlib', '2.5.22',
'9.el6', '', 'noarch')<br />
+today = datetime.today()<br />
+earliest_occurrence = xmlrpclib.DateTime(today)<br />
+client.system.schedulePackageInstall(key, 1000000001, package_list[0]['id'],
+earliest_occurrence)<br />
+<br />
+client.auth.logout(key)<br />
+</code>
<hr />
For more examples visit the <a
href="https://fedorahosted.org/spacewalk/">Spacewalk community
page</a>.
diff --git a/java/buildconf/apidoc/singlepage/scripts.txt
b/java/buildconf/apidoc/singlepage/scripts.txt
index ee98ca0..f6c0335 100644
--- a/java/buildconf/apidoc/singlepage/scripts.txt
+++ b/java/buildconf/apidoc/singlepage/scripts.txt
@@ -51,6 +51,33 @@ for user in list:<br />
<br />
client.auth.logout(key)<br />
</code>
+<p />
+Following code show how to use date-time parameters. This code will schedule
+immediatelly installation of package rhnlib-2.5.22.9.el6.noarch to system with
+id 1000000001.
+<p />
+
+<code>
+#!/usr/bin/python<br />
+from datetime import datetime<br />
+import time<br />
+import xmlrpclib<br />
+<br />
+SATELLITE_URL = "http://satellite.example.com/rpc/api"<br />
+SATELLITE_LOGIN = "username"<br />
+SATELLITE_PASSWORD = "password"<br />
+<br />
+client = xmlrpclib.Server(SATELLITE_URL, verbose=0)<br />
+<br />
+key = client.auth.login(SATELLITE_LOGIN, SATELLITE_PASSWORD)<br />
+package_list = client.packages.findByNvrea(key, 'rhnlib', '2.5.22',
'9.el6', '', 'noarch')<br />
+today = datetime.today()<br />
+earliest_occurrence = xmlrpclib.DateTime(today)<br />
+client.system.schedulePackageInstall(key, 1000000001, package_list[0]['id'],
+earliest_occurrence)<br />
+<br />
+client.auth.logout(key)<br />
+</code>
<hr />
For more examples visit the <a
href="https://fedorahosted.org/spacewalk/">Spacewalk community
page</a>.