java/code
by Devan Goodwin
java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml | 16 ------
java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java | 23 ----------
java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java | 9 ---
3 files changed, 2 insertions(+), 46 deletions(-)
New commits:
commit 06b89603b02bc4f2ce0b28f484eb02835dd84c43
Author: Devan Goodwin <dgoodwin(a)redhat.com>
Date: Thu Jun 4 13:00:44 2009 -0300
Revert "adding better support for kickstart cent, whereby we install/udpate the client packages on all distros and not just RHEL-2,3,4"
This reverts commit f5376cb97e47c0a917b2234636013a5d96f99cfb.
This change conflicts with the fix for bugzilla #448697, and we're not
entirely sure this is the correct way to proceed for CentOS in any case.
(it rapidly gets unmaintainable with different versions of
CentOS/Fedora/etc).
Conflicts:
java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
index eaea5a0..92fbc33 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
@@ -1028,22 +1028,6 @@ SELECT CP.package_id, CP.name_id, CP.evr_id, CP.package_arch_id
</query>
</mode>
-<mode name="latest_package_equal_in_tree">
- <query params="cid, name">
-SELECT CP.package_id, CP.name_id, CP.evr_id, CP.package_arch_id
- FROM rhnPackageName PN inner join
- rhnChannelNewestPackage CP on CP.name_id = PN.id inner join
- rhnChannel C on C.id = Cp.channel_id inner join
- rhnPackage P on P.id = CP.package_id inner join
- rhnPackageEvr EVR on P.evr_id = EVR.id
- WHERE ( C.id = :cid or C.parent_channel = :cid)
- AND PN.name = :name
- AND C.label not like '%beta%'
- order by EVR.evr DESC
- </query>
-</mode>
-
-
<mode name="latest_package_like">
<query params="cid, name">
SELECT CP.package_id, CP.name_id, CP.evr_id
diff --git a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
index 41433a2..6add7da 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
@@ -1381,29 +1381,6 @@ public class ChannelManager extends BaseManager {
}
/**
- * Get the id of latest packages located in the channel tree
- * where channelId is a parent
- *
- * @param channelId to lookup package against
- * @param packageName to check
- * @return List containing Maps of "CP.package_id, CP.name_id, CP.evr_id"
- */
- public static Long getLatestPackageEqualInTree(Long channelId, String packageName) {
- SelectMode m = ModeFactory.getMode("Channel_queries",
- "latest_package_equal_in_tree");
- Map params = new HashMap();
- params.put("cid", channelId);
- params.put("name", packageName);
- List results = m.execute(params);
- if (results != null && results.size() > 0) {
- Map row = (Map) results.get(0);
- return (Long) row.get("package_id");
- }
- return null;
- }
-
-
- /**
* List the latest packages equal in the passed in Channel and name
*
* @param channelId to lookup package against
diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
index 5c8d3c1..6d54832 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
@@ -101,15 +101,13 @@ public class KickstartFormatter {
NEWLINE;
public static final String[] UPDATE_PKG_NAMES =
{"pyOpenSSL", "rhnlib", "libxml2-python"};
- public static final String[] FRESH_PKG_NAMES_RHEL5 =
- {"rhn-setup", "yum-rhn-plugin", "rhnsd", "rhn-client-tools", "rhn-check"};
public static final String[] FRESH_PKG_NAMES_RHEL34 =
{"up2date", "up2date-gnome"};
public static final String[] FRESH_PKG_NAMES_RHEL2 =
{"rhn_register", "up2date", "rhn_register-gnome", "up2date-gnome"};
private static final String UPDATE_OPT_PATH = "/tmp/rhn_rpms/optional/";
private static final String UPDATE_CMD = "rpm -Uvh --replacepkgs --replacefiles ";
- private static final String FRESH_CMD = "rpm -Uvh /tmp/rhn_rpms/*rpm";
+ private static final String FRESH_CMD = "rpm -Fvh /tmp/rhn_rpms/*rpm";
private static final String IMPORT_RHN_KEY5 =
"rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release";
private static final String IMPORT_RHN_KEY34 =
@@ -816,12 +814,9 @@ public class KickstartFormatter {
else if (ksdata.isRhel3() || ksdata.isRhel4()) {
pkglist = FRESH_PKG_NAMES_RHEL34;
}
- else {
- pkglist = FRESH_PKG_NAMES_RHEL5;
- }
HashSet retval = new HashSet();
for (int i = 0; i < pkglist.length; i++) {
- Long packageId = ChannelManager.getLatestPackageEqualInTree(c.getId(),
+ Long packageId = ChannelManager.getLatestPackageEqual(c.getId(),
pkglist[i]);
if (packageId != null) {
Package p = PackageFactory.lookupByIdAndUser(packageId, user);
14 years, 12 months
Branch 'VADER' - 5 commits - java/code proxy/installer
by Miroslav Suchý
java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java | 7 -
proxy/installer/configure-proxy.sh | 10 +
proxy/installer/configure-proxy.sh.sgml | 46 +++++++++
proxy/installer/rhn-proxy-activate.sgml | 20 +++
proxy/installer/rhn_proxy_activate.py | 51 ++++++++++
5 files changed, 128 insertions(+), 6 deletions(-)
New commits:
commit 0d72257f5df8bcac9f003fff651f8f82922c2d16
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 4 16:18:25 2009 +0200
enable services
(cherry picked from commit e7fad78e3d10b577134f3ceb04e089334e684397)
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index 1dfa137..2e3ce5e 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -461,9 +461,7 @@ if [ $ENABLE_SCOUT -ne 0 ]; then
fi
for service in squid httpd jabberd $MonitoringScout; do
/sbin/chkconfig --add $service
- if [ "$1" = "1" ] ; then # first install
- /sbin/chkconfig --level 345 $service on
- fi
+ /sbin/chkconfig --level 345 $service on
done
/usr/sbin/rhn-proxy restart
commit 6d4ad92dd2cae2149dce48864c9480fb16f1b452
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 4 15:27:12 2009 +0200
499399 - update rhn-proxy-activate man page
add --enable-monitoring option
add --list-available-version option
(cherry picked from commit 492fd8eeef79cf0e3e451f50767c5a28dea945c9)
diff --git a/proxy/installer/rhn-proxy-activate.sgml b/proxy/installer/rhn-proxy-activate.sgml
index da638b2..1d68882 100644
--- a/proxy/installer/rhn-proxy-activate.sgml
+++ b/proxy/installer/rhn-proxy-activate.sgml
@@ -25,6 +25,7 @@
<Synopsis>
<cmdsynopsis>
<command>&SCRIPTCOMMAND;</command>
+ <arg><replaceable>command</replaceable></arg>
<arg>options <replaceable>...</replaceable></arg>
<arg>-s<replaceable>HOSTNAME</replaceable></arg>
<arg>--server=<replaceable>HOSTNAME</replaceable></arg>
@@ -61,6 +62,25 @@
utility that will activate an &RHNPROXY; from the commandline of
the RHN Proxy itself.
</para>
+<para>
+ Without any command specified, this script will activate Spacewalk Proxy.
+ For other possibility see COMMANDS section.
+</RefSect1>
+
+<RefSect1><Title>COMMANDS</Title>
+<variablelist>
+ <varlistentry>
+ <term>-m, --enable-monitoring</term>
+ <listitem>
+ <para>Will enable Monitoring Scout on this Proxy. Proxy should be already activated before this command.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>-l, --list-available-versions</term>
+ <listitem>
+ <para>List available versions of RHN Proxy on parent.</para>
+ </listitem>
+ </varlistentry>
</RefSect1>
<RefSect1><Title>Options</Title>
commit f325fdde299eeb6c056c221570d3f473ec548f0f
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 4 15:18:33 2009 +0200
fix docbook warnings
(cherry picked from commit 14f7faaaf80c1f7937016e35c0f6c00dea1dcb62)
diff --git a/proxy/installer/configure-proxy.sh.sgml b/proxy/installer/configure-proxy.sh.sgml
index 0fe6435..3d0e7fc 100644
--- a/proxy/installer/configure-proxy.sh.sgml
+++ b/proxy/installer/configure-proxy.sh.sgml
@@ -219,94 +219,140 @@ provide a required response, default answer is used.</para>
<listitem>
<para>Version of &RHNPROXY; you want to activate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>RHN_PARENT</term>
<listitem>
<para>Your parent Spacewalk server.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>TRACEBACK_EMAIL</term>
<listitem>
<para>Email to which tracebacks should be sent.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>USE_SSL</term>
<listitem>
<para>1 if &RHNPROXY; should communicate with parent over SSL. 0 otherwise. Even if disabled, client can still use SSL to connect to &RHNPROXY;</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>CA_CHAIN</term>
<listitem>
<para>The CA cert used to verify the ssl connection to parent.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>FORCE_OWN_CA</term>
<listitem>
<para>Do not use parent CA and force to create your own.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>HTTP_PROXY</term>
<listitem>
<para>HTTP proxy in host:port format, e.g. squid.redhat.com:3128</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>HTTP_USERNAME</term>
<listitem>
<para>The username for an authenticated proxy.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>HTTP_PASSWORD</term>
<listitem>
<para>The password to use for an authenticated proxy.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_BUILD_DIR</term>
<listitem>
<para>The directory where we build SSL certificate. Default is /root/ssl-build.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_ORG</term>
<listitem>
<para>Organization name to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_ORGUNIT</term>
<listitem>
<para>Organization unit name to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_COMMON</term>
<listitem>
<para>Common name to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_CITY</term>
<listitem>
<para>City to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_STATE</term>
<listitem>
<para>State to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_COUNTRY</term>
<listitem>
<para>Two letters country code to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_EMAIL</term>
<listitem>
<para>Email to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_PASSWORD</term>
<listitem>
<para>Password to be used for SSL CA certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>INSTALL_MONITORING</term>
<listitem>
<para>Y if monitoring should be installed. Any other value means that monitoring will not be installed.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>ENABLE_SCOUT</term>
<listitem>
<para>1 to enable monitoring scout, 0 otherwise.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>MONITORING_PARENT</term>
<listitem>
<para>Name of the parent for your scout. Usually the same value as in RHN_PARENT.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>MONITORING_PARENT_IP</term>
<listitem>
<para>IP address of MONITORING_PARENT</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SCOUT_SHARED_KEY</term>
<listitem>
<para>Your scout shared key (can be found on the parent in /etc/rhn/cluster.ini as key scoutsharedkey).</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>POPULATE_CONFIG_CHANNEL</term>
<listitem>
<para>Y if config chanel should be created and configuration files in that channel updated.
commit b00e047e7cf61f087945be2a53638c7f0e7614a3
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 4 15:14:41 2009 +0200
499399 - call proxy.createMonitoringScout during proxy activation
(cherry picked from commit 474f62180e295dd2bc302fbcd03f3515eb5a5615)
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index bf56977..1dfa137 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -452,6 +452,12 @@ fi
echo "Enabling Spacewalk Proxy."
if [ $ENABLE_SCOUT -ne 0 ]; then
MonitoringScout="MonitoringScout"
+ /usr/bin/rhn-proxy-activate --enable-monitoring \
+ --server="$RHN_PARENT" \
+ --http-proxy="$HTTP_PROXY" \
+ --http-proxy-username="$HTTP_USERNAME" \
+ --http-proxy-password="$HTTP_PASSWORD" \
+ --ca-cert="$CA_CHAIN"
fi
for service in squid httpd jabberd $MonitoringScout; do
/sbin/chkconfig --add $service
diff --git a/proxy/installer/rhn_proxy_activate.py b/proxy/installer/rhn_proxy_activate.py
index bb12fe2..ca620e1 100644
--- a/proxy/installer/rhn_proxy_activate.py
+++ b/proxy/installer/rhn_proxy_activate.py
@@ -363,6 +363,8 @@ def _activateProxy_api_v3_x(options, apiVersion):
errorCode, errorString = 0, ''
try:
s.proxy.activate_proxy(systemid, str(options.version))
+ if options.enable_monitoring:
+ s.proxy.create_monitoring_scout(systemid)
except:
errorCode, errorString = _errorHandler()
try:
@@ -386,6 +388,40 @@ def _activateProxy_api_v3_x(options, apiVersion):
sys.stdout.write("RHN Proxy successfully activated.\n")
return (errorCode, errorString)
+def createMonitoringScout(options):
+ """ Activate MonitoringScout.
+ Just create record on parent.
+ use activateProxy_api_v3_x method instead.
+ """
+
+ getServer(options, DEFAULT_WEBRPC_HANDLER_v3_x)
+ systemid = getSystemId()
+
+ errorCode, errorString = 0, ''
+ try:
+ s.proxy.create_monitoring_scout(systemid)
+ except:
+ errorCode, errorString = _errorHandler()
+ try:
+ raise
+ except SSL.SSL.Error:
+ # let's force a system exit for this one.
+ sys.stderr.write(errorString + '\n')
+ sys.exit(errorCode)
+ except (rpclib.Fault, Exception):
+ # let's force a slight change in messaging for this one.
+ errorString = "ERROR: upon entitlement/activation attempt: %s" % errorString
+ except (rpclib.ProtocolError, socket.error):
+ sys.stderr.write(errorString + '\n')
+ sys.exit(errorCode)
+ except:
+ errorString = "ERROR: upon activation attempt (something unexpected): %s" % errorString
+ return errorCode, errorString
+ else:
+ errorCode = 0
+ if not options.quiet:
+ sys.stdout.write("Monitoring Scout successfully created.\n")
+ return (errorCode, errorString)
def activateProxy(options, apiVersion):
""" Activate proxy. Decide how to do it upon apiVersion. Currently we
@@ -446,6 +482,8 @@ def processCommandline():
Option('--ca-cert', action='store', help="alternative SSL certificate to use, default is %s" % repr(ca_cert), default=ca_cert),
Option('--no-ssl', action='store_true', help='turn off SSL (not advisable), default is on.'),
Option('--version', action='store', help='which X.Y version of the RHN Proxy are you upgrading to? Default is your current proxy version ('+defaultVersion+')', default=defaultVersion),
+ Option('-m', '--enable-monitoring',
+ action='store_true', help='enable MonitoringScout on this proxy.'),
Option('--deactivate', action='store_true', help='deactivate proxy, if already activated'),
Option('-l','--list-available-versions', action='store_true', help='print list of versions available to this system'),
Option('--non-interactive', action='store_true', help='non-interactive mode'),
@@ -523,6 +561,19 @@ def main():
listAvailableProxyChannels(options)
sys.exit(0)
+ if options.enable_monitoring:
+ resolveHostnamePort(options.http_proxy)
+ if not options.http_proxy:
+ resolveHostnamePort(options.server)
+ errorCode, errorString = createMonitoringScout(options)
+ if errorCode != 0:
+ if not errorString:
+ errorString = ("An unknown error occured. Consult with your Red Hat representative.\n")
+ sys.stderr.write("\nThere was a problem activating Monitoring Scout:\n%s\n" % errorString)
+ sys.exit(abs(errorCode))
+ else:
+ sys.exit(0)
+
noSslString = 'false'
if options.no_ssl:
noSslString = 'true'
commit 52a9a0caa50d0b323b11de5bb9cc52641e49bf48
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 4 15:08:43 2009 +0200
499399 - save scout to db
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java
index a4b7d49..57daf18 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java
@@ -17,7 +17,6 @@ package com.redhat.rhn.frontend.xmlrpc.proxy;
import com.redhat.rhn.common.client.ClientCertificate;
import com.redhat.rhn.common.client.ClientCertificateDigester;
import com.redhat.rhn.common.client.InvalidCertificateException;
-import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.domain.channel.Channel;
import com.redhat.rhn.domain.channel.ChannelFamily;
import com.redhat.rhn.domain.channel.ChannelFamilyFactory;
@@ -96,8 +95,7 @@ public class ProxyHandler extends BaseHandler {
User owner = server.getCreator();
SatCluster scout = SatClusterFactory.createSatCluster(owner);
- scout.setDescription(LocalizationService.getInstance().
- getMessage("RHN Proxy") + " " +
+ scout.setDescription("RHN Proxy" + " " +
server.getHostname() +
" (" + server.getId() + ")");
scout.setVip(server.getIpAddress());
@@ -107,6 +105,9 @@ public class ProxyHandler extends BaseHandler {
node.setLastUpdateUser(owner.getLogin());
node.setLastUpdateDate(new Date());
+ SatClusterFactory.saveSatCluster(scout);
+ SatClusterFactory.saveSatNode(node);
+
return 1;
}
else {
14 years, 12 months
Branch 'VADER' - backend/server
by Pradeep Kilambi
backend/server/handlers/app/packages.py | 29 +++++++++++++++++++++++------
backend/server/importlib/packageImport.py | 2 --
2 files changed, 23 insertions(+), 8 deletions(-)
New commits:
commit 1bc92f17083c1c3be2149cf14e3df8c2602c4ba7
Author: Pradeep Kilambi <pkilambi(a)redhat.com>
Date: Thu Jun 4 10:13:03 2009 -0400
fixing duplicate entries in repogen tables and other clean aup
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index 372933f..f982b5b 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -427,10 +427,13 @@ class Packages(RPC_Base):
if orgid == 'null':
org_id, force = rhnPackageUpload.authenticate(username, password,
- channels=channels, null_org=1, force=force)
+ channels=channels,
+ null_org=1,
+ force=force)
else:
org_id, force = rhnPackageUpload.authenticate(username, password,
- channels=channels, force=force)
+ channels=channels,
+ force=force)
return self._getPackageMD5sum(org_id, pkg_infos, info)
def getPackageMD5sumBySession(self, session_string, info):
@@ -500,9 +503,20 @@ class Packages(RPC_Base):
pkg_epoch = pkg_info['epoch']
if md5sum_exists:
- h.execute(pkg_name=pkg_info['name'], pkg_epoch=pkg_epoch, pkg_version=pkg_info['version'], pkg_rel=pkg_info['release'],pkg_arch=pkg_info['arch'], orgid = org_id,md5sum = pkg_info['md5sum'] )
+ h.execute(pkg_name=pkg_info['name'],
+ pkg_epoch=pkg_epoch,
+ pkg_version=pkg_info['version'],
+ pkg_rel=pkg_info['release'],
+ pkg_arch=pkg_info['arch'],
+ orgid = org_id,
+ md5sum = pkg_info['md5sum'] )
else:
- h.execute(pkg_name=pkg_info['name'], pkg_epoch=pkg_epoch, pkg_version=pkg_info['version'], pkg_rel=pkg_info['release'],pkg_arch=pkg_info['arch'], orgid = org_id)
+ h.execute(pkg_name=pkg_info['name'],
+ pkg_epoch=pkg_epoch,
+ pkg_version=pkg_info['version'],
+ pkg_rel=pkg_info['release'],
+ pkg_arch=pkg_info['arch'],
+ orgid = org_id )
row = h.fetchone_dict()
if not row:
@@ -538,10 +552,13 @@ class Packages(RPC_Base):
if orgid == 'null':
org_id, force = rhnPackageUpload.authenticate(username, password,
- channels=channels, null_org=1, force=force)
+ channels=channels,
+ null_org=1,
+ force=force)
else:
org_id, force = rhnPackageUpload.authenticate(username, password,
- channels=channels, force=force)
+ channels=channels,
+ force=force)
return self._getSourcePackageMD5sum(org_id, pkg_infos, info)
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index 6b359b2..22a7d1e 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -111,8 +111,6 @@ class ChannelPackageSubscription(GenericPackageImport):
self.compute_affected_channels(affected_channels)
self.backend.update_newest_package_cache(caller=self.caller,
affected_channels=self.affected_channel_packages)
- taskomatic.add_to_repodata_queue_for_channel_package_subscription(
- self.affected_channels, self.batch, self.caller)
self.backend.commit()
def compute_affected_channels(self, affected_channels):
14 years, 12 months
5 commits - java/code proxy/installer
by Miroslav Suchý
java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java | 7 -
proxy/installer/configure-proxy.sh | 10 +
proxy/installer/configure-proxy.sh.sgml | 46 +++++++++
proxy/installer/rhn-proxy-activate.sgml | 20 +++
proxy/installer/rhn_proxy_activate.py | 51 ++++++++++
5 files changed, 128 insertions(+), 6 deletions(-)
New commits:
commit e7fad78e3d10b577134f3ceb04e089334e684397
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 4 16:18:25 2009 +0200
enable services
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index 509fcab..c96d841 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -464,9 +464,7 @@ if [ $ENABLE_SCOUT -ne 0 ]; then
fi
for service in squid httpd jabberd $MonitoringScout; do
/sbin/chkconfig --add $service
- if [ "$1" = "1" ] ; then # first install
- /sbin/chkconfig --level 345 $service on
- fi
+ /sbin/chkconfig --level 345 $service on
done
/usr/sbin/rhn-proxy restart
commit 492fd8eeef79cf0e3e451f50767c5a28dea945c9
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 4 15:27:12 2009 +0200
499399 - update rhn-proxy-activate man page
add --enable-monitoring option
add --list-available-version option
diff --git a/proxy/installer/rhn-proxy-activate.sgml b/proxy/installer/rhn-proxy-activate.sgml
index da638b2..1d68882 100644
--- a/proxy/installer/rhn-proxy-activate.sgml
+++ b/proxy/installer/rhn-proxy-activate.sgml
@@ -25,6 +25,7 @@
<Synopsis>
<cmdsynopsis>
<command>&SCRIPTCOMMAND;</command>
+ <arg><replaceable>command</replaceable></arg>
<arg>options <replaceable>...</replaceable></arg>
<arg>-s<replaceable>HOSTNAME</replaceable></arg>
<arg>--server=<replaceable>HOSTNAME</replaceable></arg>
@@ -61,6 +62,25 @@
utility that will activate an &RHNPROXY; from the commandline of
the RHN Proxy itself.
</para>
+<para>
+ Without any command specified, this script will activate Spacewalk Proxy.
+ For other possibility see COMMANDS section.
+</RefSect1>
+
+<RefSect1><Title>COMMANDS</Title>
+<variablelist>
+ <varlistentry>
+ <term>-m, --enable-monitoring</term>
+ <listitem>
+ <para>Will enable Monitoring Scout on this Proxy. Proxy should be already activated before this command.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>-l, --list-available-versions</term>
+ <listitem>
+ <para>List available versions of RHN Proxy on parent.</para>
+ </listitem>
+ </varlistentry>
</RefSect1>
<RefSect1><Title>Options</Title>
commit 14f7faaaf80c1f7937016e35c0f6c00dea1dcb62
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 4 15:18:33 2009 +0200
fix docbook warnings
diff --git a/proxy/installer/configure-proxy.sh.sgml b/proxy/installer/configure-proxy.sh.sgml
index 0fe6435..3d0e7fc 100644
--- a/proxy/installer/configure-proxy.sh.sgml
+++ b/proxy/installer/configure-proxy.sh.sgml
@@ -219,94 +219,140 @@ provide a required response, default answer is used.</para>
<listitem>
<para>Version of &RHNPROXY; you want to activate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>RHN_PARENT</term>
<listitem>
<para>Your parent Spacewalk server.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>TRACEBACK_EMAIL</term>
<listitem>
<para>Email to which tracebacks should be sent.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>USE_SSL</term>
<listitem>
<para>1 if &RHNPROXY; should communicate with parent over SSL. 0 otherwise. Even if disabled, client can still use SSL to connect to &RHNPROXY;</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>CA_CHAIN</term>
<listitem>
<para>The CA cert used to verify the ssl connection to parent.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>FORCE_OWN_CA</term>
<listitem>
<para>Do not use parent CA and force to create your own.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>HTTP_PROXY</term>
<listitem>
<para>HTTP proxy in host:port format, e.g. squid.redhat.com:3128</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>HTTP_USERNAME</term>
<listitem>
<para>The username for an authenticated proxy.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>HTTP_PASSWORD</term>
<listitem>
<para>The password to use for an authenticated proxy.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_BUILD_DIR</term>
<listitem>
<para>The directory where we build SSL certificate. Default is /root/ssl-build.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_ORG</term>
<listitem>
<para>Organization name to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_ORGUNIT</term>
<listitem>
<para>Organization unit name to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_COMMON</term>
<listitem>
<para>Common name to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_CITY</term>
<listitem>
<para>City to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_STATE</term>
<listitem>
<para>State to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_COUNTRY</term>
<listitem>
<para>Two letters country code to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_EMAIL</term>
<listitem>
<para>Email to be used in SSL certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SSL_PASSWORD</term>
<listitem>
<para>Password to be used for SSL CA certificate.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>INSTALL_MONITORING</term>
<listitem>
<para>Y if monitoring should be installed. Any other value means that monitoring will not be installed.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>ENABLE_SCOUT</term>
<listitem>
<para>1 to enable monitoring scout, 0 otherwise.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>MONITORING_PARENT</term>
<listitem>
<para>Name of the parent for your scout. Usually the same value as in RHN_PARENT.</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>MONITORING_PARENT_IP</term>
<listitem>
<para>IP address of MONITORING_PARENT</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>SCOUT_SHARED_KEY</term>
<listitem>
<para>Your scout shared key (can be found on the parent in /etc/rhn/cluster.ini as key scoutsharedkey).</para>
</listitem>
+ </varlistentry>
+ <varlistentry>
<term>POPULATE_CONFIG_CHANNEL</term>
<listitem>
<para>Y if config chanel should be created and configuration files in that channel updated.
commit 474f62180e295dd2bc302fbcd03f3515eb5a5615
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 4 15:14:41 2009 +0200
499399 - call proxy.createMonitoringScout during proxy activation
diff --git a/proxy/installer/configure-proxy.sh b/proxy/installer/configure-proxy.sh
index 043bd79..509fcab 100755
--- a/proxy/installer/configure-proxy.sh
+++ b/proxy/installer/configure-proxy.sh
@@ -455,6 +455,12 @@ fi
echo "Enabling Spacewalk Proxy."
if [ $ENABLE_SCOUT -ne 0 ]; then
MonitoringScout="MonitoringScout"
+ /usr/bin/rhn-proxy-activate --enable-monitoring \
+ --server="$RHN_PARENT" \
+ --http-proxy="$HTTP_PROXY" \
+ --http-proxy-username="$HTTP_USERNAME" \
+ --http-proxy-password="$HTTP_PASSWORD" \
+ --ca-cert="$CA_CHAIN"
fi
for service in squid httpd jabberd $MonitoringScout; do
/sbin/chkconfig --add $service
diff --git a/proxy/installer/rhn_proxy_activate.py b/proxy/installer/rhn_proxy_activate.py
index 69ccccb..af5fe3c 100644
--- a/proxy/installer/rhn_proxy_activate.py
+++ b/proxy/installer/rhn_proxy_activate.py
@@ -367,6 +367,8 @@ def _activateProxy_api_v3_x(options, apiVersion):
errorCode, errorString = 0, ''
try:
s.proxy.activate_proxy(systemid, str(options.version))
+ if options.enable_monitoring:
+ s.proxy.create_monitoring_scout(systemid)
except:
errorCode, errorString = _errorHandler()
try:
@@ -390,6 +392,40 @@ def _activateProxy_api_v3_x(options, apiVersion):
sys.stdout.write("RHN Proxy successfully activated.\n")
return (errorCode, errorString)
+def createMonitoringScout(options):
+ """ Activate MonitoringScout.
+ Just create record on parent.
+ use activateProxy_api_v3_x method instead.
+ """
+
+ getServer(options, DEFAULT_WEBRPC_HANDLER_v3_x)
+ systemid = getSystemId()
+
+ errorCode, errorString = 0, ''
+ try:
+ s.proxy.create_monitoring_scout(systemid)
+ except:
+ errorCode, errorString = _errorHandler()
+ try:
+ raise
+ except SSL.SSL.Error:
+ # let's force a system exit for this one.
+ sys.stderr.write(errorString + '\n')
+ sys.exit(errorCode)
+ except (rpclib.Fault, Exception):
+ # let's force a slight change in messaging for this one.
+ errorString = "ERROR: upon entitlement/activation attempt: %s" % errorString
+ except (rpclib.ProtocolError, socket.error):
+ sys.stderr.write(errorString + '\n')
+ sys.exit(errorCode)
+ except:
+ errorString = "ERROR: upon activation attempt (something unexpected): %s" % errorString
+ return errorCode, errorString
+ else:
+ errorCode = 0
+ if not options.quiet:
+ sys.stdout.write("Monitoring Scout successfully created.\n")
+ return (errorCode, errorString)
def activateProxy(options, apiVersion):
""" Activate proxy. Decide how to do it upon apiVersion. Currently we
@@ -450,6 +486,8 @@ def processCommandline():
Option('--ca-cert', action='store', help="alternative SSL certificate to use, default is %s" % repr(ca_cert), default=ca_cert),
Option('--no-ssl', action='store_true', help='turn off SSL (not advisable), default is on.'),
Option('--version', action='store', help='which X.Y version of the RHN Proxy are you upgrading to? Default is your current proxy version ('+defaultVersion+')', default=defaultVersion),
+ Option('-m', '--enable-monitoring',
+ action='store_true', help='enable MonitoringScout on this proxy.'),
Option('--deactivate', action='store_true', help='deactivate proxy, if already activated'),
Option('-l','--list-available-versions', action='store_true', help='print list of versions available to this system'),
Option('--non-interactive', action='store_true', help='non-interactive mode'),
@@ -527,6 +565,19 @@ def main():
listAvailableProxyChannels(options)
sys.exit(0)
+ if options.enable_monitoring:
+ resolveHostnamePort(options.http_proxy)
+ if not options.http_proxy:
+ resolveHostnamePort(options.server)
+ errorCode, errorString = createMonitoringScout(options)
+ if errorCode != 0:
+ if not errorString:
+ errorString = ("An unknown error occured. Consult with your Red Hat representative.\n")
+ sys.stderr.write("\nThere was a problem activating Monitoring Scout:\n%s\n" % errorString)
+ sys.exit(abs(errorCode))
+ else:
+ sys.exit(0)
+
noSslString = 'false'
if options.no_ssl:
noSslString = 'true'
commit 061bab2e20f7806f8fdbff8269d93d9ed7543f86
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 4 15:08:43 2009 +0200
499399 - save scout to db
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java
index a4b7d49..57daf18 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/proxy/ProxyHandler.java
@@ -17,7 +17,6 @@ package com.redhat.rhn.frontend.xmlrpc.proxy;
import com.redhat.rhn.common.client.ClientCertificate;
import com.redhat.rhn.common.client.ClientCertificateDigester;
import com.redhat.rhn.common.client.InvalidCertificateException;
-import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.domain.channel.Channel;
import com.redhat.rhn.domain.channel.ChannelFamily;
import com.redhat.rhn.domain.channel.ChannelFamilyFactory;
@@ -96,8 +95,7 @@ public class ProxyHandler extends BaseHandler {
User owner = server.getCreator();
SatCluster scout = SatClusterFactory.createSatCluster(owner);
- scout.setDescription(LocalizationService.getInstance().
- getMessage("RHN Proxy") + " " +
+ scout.setDescription("RHN Proxy" + " " +
server.getHostname() +
" (" + server.getId() + ")");
scout.setVip(server.getIpAddress());
@@ -107,6 +105,9 @@ public class ProxyHandler extends BaseHandler {
node.setLastUpdateUser(owner.getLogin());
node.setLastUpdateDate(new Date());
+ SatClusterFactory.saveSatCluster(scout);
+ SatClusterFactory.saveSatNode(node);
+
return 1;
}
else {
14 years, 12 months
backend/server
by Pradeep Kilambi
backend/server/handlers/app/packages.py | 29 +++++++++++++++++++++++------
backend/server/importlib/packageImport.py | 2 --
2 files changed, 23 insertions(+), 8 deletions(-)
New commits:
commit 75b6c91adf12a585dec90bf695fa960358a3029b
Author: Pradeep Kilambi <pkilambi(a)redhat.com>
Date: Thu Jun 4 10:13:03 2009 -0400
fixing duplicate entries in repogen tables and other clean aup
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index 372933f..f982b5b 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -427,10 +427,13 @@ class Packages(RPC_Base):
if orgid == 'null':
org_id, force = rhnPackageUpload.authenticate(username, password,
- channels=channels, null_org=1, force=force)
+ channels=channels,
+ null_org=1,
+ force=force)
else:
org_id, force = rhnPackageUpload.authenticate(username, password,
- channels=channels, force=force)
+ channels=channels,
+ force=force)
return self._getPackageMD5sum(org_id, pkg_infos, info)
def getPackageMD5sumBySession(self, session_string, info):
@@ -500,9 +503,20 @@ class Packages(RPC_Base):
pkg_epoch = pkg_info['epoch']
if md5sum_exists:
- h.execute(pkg_name=pkg_info['name'], pkg_epoch=pkg_epoch, pkg_version=pkg_info['version'], pkg_rel=pkg_info['release'],pkg_arch=pkg_info['arch'], orgid = org_id,md5sum = pkg_info['md5sum'] )
+ h.execute(pkg_name=pkg_info['name'],
+ pkg_epoch=pkg_epoch,
+ pkg_version=pkg_info['version'],
+ pkg_rel=pkg_info['release'],
+ pkg_arch=pkg_info['arch'],
+ orgid = org_id,
+ md5sum = pkg_info['md5sum'] )
else:
- h.execute(pkg_name=pkg_info['name'], pkg_epoch=pkg_epoch, pkg_version=pkg_info['version'], pkg_rel=pkg_info['release'],pkg_arch=pkg_info['arch'], orgid = org_id)
+ h.execute(pkg_name=pkg_info['name'],
+ pkg_epoch=pkg_epoch,
+ pkg_version=pkg_info['version'],
+ pkg_rel=pkg_info['release'],
+ pkg_arch=pkg_info['arch'],
+ orgid = org_id )
row = h.fetchone_dict()
if not row:
@@ -538,10 +552,13 @@ class Packages(RPC_Base):
if orgid == 'null':
org_id, force = rhnPackageUpload.authenticate(username, password,
- channels=channels, null_org=1, force=force)
+ channels=channels,
+ null_org=1,
+ force=force)
else:
org_id, force = rhnPackageUpload.authenticate(username, password,
- channels=channels, force=force)
+ channels=channels,
+ force=force)
return self._getSourcePackageMD5sum(org_id, pkg_infos, info)
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index 6b359b2..22a7d1e 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -111,8 +111,6 @@ class ChannelPackageSubscription(GenericPackageImport):
self.compute_affected_channels(affected_channels)
self.backend.update_newest_package_cache(caller=self.caller,
affected_channels=self.affected_channel_packages)
- taskomatic.add_to_repodata_queue_for_channel_package_subscription(
- self.affected_channels, self.batch, self.caller)
self.backend.commit()
def compute_affected_channels(self, affected_channels):
14 years, 12 months
Branch 'VADER' - projects/oracle-server-scripts
by Milan Zazrivec
projects/oracle-server-scripts/init-params.ora | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 7ad13e86847749a5511d821e563e943dffb06ecf
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Jun 4 11:28:34 2009 +0200
We use 10.2.0.4 embedded db now
diff --git a/projects/oracle-server-scripts/init-params.ora b/projects/oracle-server-scripts/init-params.ora
index c2754a5..cdefa27 100755
--- a/projects/oracle-server-scripts/init-params.ora
+++ b/projects/oracle-server-scripts/init-params.ora
@@ -27,7 +27,7 @@ job_queue_processes=10
###########################################
# Miscellaneous
###########################################
-compatible=10.2.0.3.0
+compatible=10.2.0.4.0
###########################################
# NLS
14 years, 12 months
projects/oracle-server-scripts
by Milan Zazrivec
projects/oracle-server-scripts/init-params.ora | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 1bbecd594b68ead93c744286a85b6dbcee5264b4
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Jun 4 11:28:34 2009 +0200
We use 10.2.0.4 embedded db now
diff --git a/projects/oracle-server-scripts/init-params.ora b/projects/oracle-server-scripts/init-params.ora
index c2754a5..cdefa27 100755
--- a/projects/oracle-server-scripts/init-params.ora
+++ b/projects/oracle-server-scripts/init-params.ora
@@ -27,7 +27,7 @@ job_queue_processes=10
###########################################
# Miscellaneous
###########################################
-compatible=10.2.0.3.0
+compatible=10.2.0.4.0
###########################################
# NLS
14 years, 12 months
java/code
by Pradeep Kilambi
java/code/src/com/redhat/rhn/domain/channel/Channel.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit a9a7ece2c1ab4f71be4fe5b1c31051f6caaaca6d
Author: Pradeep Kilambi <pkilambi(a)redhat.com>
Date: Wed Jun 3 18:50:48 2009 -0400
504023 - fixing repodata generation to skip solaris custom channels
diff --git a/java/code/src/com/redhat/rhn/domain/channel/Channel.java b/java/code/src/com/redhat/rhn/domain/channel/Channel.java
index cef2312..57ffc57 100644
--- a/java/code/src/com/redhat/rhn/domain/channel/Channel.java
+++ b/java/code/src/com/redhat/rhn/domain/channel/Channel.java
@@ -54,6 +54,9 @@ public class Channel extends BaseDomainHelper implements Comparable {
private static List<String> releaseToSkipRepodata = new ArrayList<String>(Arrays
.asList("2.1AS", "2.1ES", "2.1WS", "3AS", "3ES", "3WS", "3Desktop", "4AS",
"4ES", "4WS", "4Desktop"));
+ private static List<String> archesToSkipRepodata = new ArrayList<String>(Arrays
+ .asList("channel-sparc-sun-solaris", "channel-i386-sun-solaris",
+ "channel-sparc"));
private String baseDir;
private ChannelArch channelArch;
private String description;
@@ -748,7 +751,9 @@ public class Channel extends BaseDomainHelper implements Comparable {
*/
public boolean isChannelRepodataRequired() {
boolean repodataRequired = false;
- if (this.isCustom()) {
+ // generate repodata for all custom channels except solaris
+ if (this.isCustom() &&
+ !archesToSkipRepodata.contains(this.channelArch.getLabel())) {
repodataRequired = true;
log.debug("isChannelRepodataRequired for channel(" + this.id +
") set to true because it is a custom Channel");
14 years, 12 months
Branch 'VADER' - java/code
by Pradeep Kilambi
java/code/src/com/redhat/rhn/domain/channel/Channel.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit b44703fd4ef7b6154c263bade8b4a9fd8f3ce8f8
Author: Pradeep Kilambi <pkilambi(a)redhat.com>
Date: Wed Jun 3 18:50:48 2009 -0400
504023 - fixing repodata generation to skip solaris custom channels
diff --git a/java/code/src/com/redhat/rhn/domain/channel/Channel.java b/java/code/src/com/redhat/rhn/domain/channel/Channel.java
index cef2312..57ffc57 100644
--- a/java/code/src/com/redhat/rhn/domain/channel/Channel.java
+++ b/java/code/src/com/redhat/rhn/domain/channel/Channel.java
@@ -54,6 +54,9 @@ public class Channel extends BaseDomainHelper implements Comparable {
private static List<String> releaseToSkipRepodata = new ArrayList<String>(Arrays
.asList("2.1AS", "2.1ES", "2.1WS", "3AS", "3ES", "3WS", "3Desktop", "4AS",
"4ES", "4WS", "4Desktop"));
+ private static List<String> archesToSkipRepodata = new ArrayList<String>(Arrays
+ .asList("channel-sparc-sun-solaris", "channel-i386-sun-solaris",
+ "channel-sparc"));
private String baseDir;
private ChannelArch channelArch;
private String description;
@@ -748,7 +751,9 @@ public class Channel extends BaseDomainHelper implements Comparable {
*/
public boolean isChannelRepodataRequired() {
boolean repodataRequired = false;
- if (this.isCustom()) {
+ // generate repodata for all custom channels except solaris
+ if (this.isCustom() &&
+ !archesToSkipRepodata.contains(this.channelArch.getLabel())) {
repodataRequired = true;
log.debug("isChannelRepodataRequired for channel(" + this.id +
") set to true because it is a custom Channel");
14 years, 12 months
Branch 'VADER' - java/code
by jdob
java/code/src/com/redhat/rhn/frontend/action/systems/SystemSearchSetupAction.java | 117 ++++------
1 file changed, 49 insertions(+), 68 deletions(-)
New commits:
commit 2707ef1ba06708257ac78eb3d5bc51a6a31e3a57
Author: Jason Dobies <jason.dobies(a)redhat.com>
Date: Wed Jun 3 15:55:39 2009 -0400
495594, 504012 - Fixed issue where invert flag disappeared on pagination; fixed ISE when search produces no results.
Also general clean up of the class.
diff --git a/java/code/src/com/redhat/rhn/frontend/action/systems/SystemSearchSetupAction.java b/java/code/src/com/redhat/rhn/frontend/action/systems/SystemSearchSetupAction.java
index 80f74b0..6c25cb5 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/systems/SystemSearchSetupAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/systems/SystemSearchSetupAction.java
@@ -16,7 +16,6 @@ package com.redhat.rhn.frontend.action.systems;
import com.redhat.rhn.common.db.datasource.DataResult;
import com.redhat.rhn.common.localization.LocalizationService;
-import com.redhat.rhn.common.util.StringUtil;
import com.redhat.rhn.frontend.action.common.BadParameterException;
import com.redhat.rhn.frontend.dto.SystemSearchResult;
import com.redhat.rhn.frontend.struts.RequestContext;
@@ -55,12 +54,10 @@ import redstone.xmlrpc.XmlRpcException;
import redstone.xmlrpc.XmlRpcFault;
/**
- * SystemSearchAction extends RhnAction - Class representation of the table ###TABLE###.
- * @version $Rev: 1 $
+ * Action handling the advanced system search page.
*/
public class SystemSearchSetupAction extends RhnAction implements Listable {
- private static Logger log = Logger.getLogger(SystemSearchSetupAction.class);
-
+
public static final String LIST_NAME = "pageList";
public static final String DATA_SET = "searchResults";
@@ -133,6 +130,8 @@ public class SystemSearchSetupAction extends RhnAction implements Listable {
private static final String FORM = "FORM";
private static final String MAPPING = "MAPPING";
+
+ private final Logger log = Logger.getLogger(SystemSearchSetupAction.class);
/** {@inheritDoc} */
public ActionForward execute(ActionMapping mapping,
@@ -153,12 +152,26 @@ public class SystemSearchSetupAction extends RhnAction implements Listable {
if (ListTagHelper.getListAction(getListName(), request) != null ||
(!isSubmitted(daForm) &&
request.getParameter(VIEW_MODE) != null)) {
+
+ String whereToSearch = daForm.getString(WHERE_TO_SEARCH);
+ Boolean invertResults = (Boolean) daForm.get(INVERT_RESULTS);
+
+ if (invertResults == null) {
+ invertResults = Boolean.FALSE;
+ }
request.setAttribute(VIEW_MODE, request.getParameter(VIEW_MODE));
request.setAttribute(SEARCH_STRING, request.getParameter(SEARCH_STRING));
- setupForm(request, daForm, request.getParameter(VIEW_MODE));
-
+ request.setAttribute(WHERE_TO_SEARCH, whereToSearch);
+
+ if (invertResults) {
+ request.setAttribute(INVERT_RESULTS, "on");
+ }
+ else {
+ request.setAttribute(INVERT_RESULTS, "off");
+ }
+ setupForm(request, daForm, request.getParameter(VIEW_MODE));
ListRhnSetHelper helper = new ListRhnSetHelper(this,
request, RhnSetDecl.SYSTEMS);
@@ -168,7 +181,8 @@ public class SystemSearchSetupAction extends RhnAction implements Listable {
helper.execute();
List results = (List)request.getAttribute(getDataSetName());
- log.info("SystemSearch results.size() = " + results.size());
+ log.info("SystemSearch results.size() = " +
+ (results != null ? results.size() : "null results"));
if ((results != null) && (results.size() == 1)) {
SystemSearchResult s = (SystemSearchResult) results.get(0);
Double score = s.getScore();
@@ -195,8 +209,7 @@ public class SystemSearchSetupAction extends RhnAction implements Listable {
}
return getStrutsDelegate().forwardParams(
mapping.findForward("default"),
- request.getParameterMap());
-
+ request.getParameterMap());
}
/**
* Else the form was submitted, so we need to parse the form and turn it into
@@ -208,6 +221,10 @@ public class SystemSearchSetupAction extends RhnAction implements Listable {
String whereToSearch = daForm.getString(WHERE_TO_SEARCH);
Boolean invertResults = (Boolean) daForm.get(INVERT_RESULTS);
+ if (invertResults == null) {
+ invertResults = Boolean.FALSE;
+ }
+
setupForm(request, daForm, viewMode);
if (whereToSearch == null || viewMode == null) {
throw new BadParameterException("An expected form var was null");
@@ -215,18 +232,25 @@ public class SystemSearchSetupAction extends RhnAction implements Listable {
request.setAttribute(SEARCH_STRING, searchString);
request.setAttribute(VIEW_MODE, viewMode);
- request.setAttribute(INVERT_RESULTS, invertResults);
request.setAttribute(WHERE_TO_SEARCH, whereToSearch);
+
+ if (invertResults) {
+ request.setAttribute(INVERT_RESULTS, "on");
+ }
+ else {
+ request.setAttribute(INVERT_RESULTS, "off");
+ }
+
ActionErrors errs = new ActionErrors();
if (viewMode.equals("systemsearch_id") ||
- viewMode.equals(SystemSearchHelper.CPU_MHZ_LT) ||
- viewMode.equals(SystemSearchHelper.CPU_MHZ_GT) ||
- viewMode.equals(SystemSearchHelper.RAM_LT) ||
- viewMode.equals(SystemSearchHelper.RAM_GT) ||
- viewMode.equals(SystemSearchHelper.NUM_CPUS_LT) ||
- viewMode.equals(SystemSearchHelper.NUM_CPUS_GT) ||
- viewMode.equals(SystemSearchHelper.CHECKIN) ||
- viewMode.equals(SystemSearchHelper.REGISTERED)) {
+ viewMode.equals(SystemSearchHelper.CPU_MHZ_LT) ||
+ viewMode.equals(SystemSearchHelper.CPU_MHZ_GT) ||
+ viewMode.equals(SystemSearchHelper.RAM_LT) ||
+ viewMode.equals(SystemSearchHelper.RAM_GT) ||
+ viewMode.equals(SystemSearchHelper.NUM_CPUS_LT) ||
+ viewMode.equals(SystemSearchHelper.NUM_CPUS_GT) ||
+ viewMode.equals(SystemSearchHelper.CHECKIN) ||
+ viewMode.equals(SystemSearchHelper.REGISTERED)) {
String regEx = "(\\d)*";
Pattern pattern = Pattern.compile(regEx);
Matcher matcher = pattern.matcher(searchString);
@@ -276,8 +300,6 @@ public class SystemSearchSetupAction extends RhnAction implements Listable {
}
}
-
-
protected void setupForm(HttpServletRequest request,
DynaActionForm form,
@@ -314,11 +336,9 @@ public class SystemSearchSetupAction extends RhnAction implements Listable {
request.setAttribute("optGroupsKeys", optGroupsMap.keySet());
}
-
protected DataResult performSearch(RequestContext context) {
HttpServletRequest request = context.getRequest();
- ActionMapping mapping = (ActionMapping) request.getAttribute(MAPPING);
String searchString = context.getParam(SEARCH_STRING, false);
String viewMode = context.getParam(VIEW_MODE, false);
String whereToSearch = context.getParam(WHERE_TO_SEARCH, false);
@@ -390,55 +410,30 @@ public class SystemSearchSetupAction extends RhnAction implements Listable {
* @return Returns the map.
*/
private Map createDisplayMap(String display, String value) {
- Map selection = new HashMap();
+ Map<String, String> selection = new HashMap<String, String>();
selection.put("display", display);
selection.put("value", value);
return selection;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public String getListName() {
return LIST_NAME;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public String getDataSetName() {
return DATA_SET;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public String getDecl(RequestContext context) {
return RhnSetDecl.SYSTEMS.getLabel();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public List getResult(RequestContext context) {
- /*String cachedName = makeKey(context);
- List result = (List)context.getRequest().getSession().getAttribute(cachedName);
- if (result != null) {
- return result;
- }*/
-
- /*
- DynaActionForm daForm = (DynaActionForm) context.getRequest().getAttribute(FORM);
- String searchString = daForm.getString(SEARCH_STRING);
- String viewMode = daForm.getString(VIEW_MODE);
- String whereToSearch = daForm.getString(WHERE_TO_SEARCH);
- Boolean invertResults = (Boolean) daForm.get(INVERT_RESULTS); */
-
String searchString = context.getParam(SEARCH_STRING, false);
- String viewMode = context.getParam(VIEW_MODE, false);
- String whereToSearch = context.getParam(WHERE_TO_SEARCH, false);
- Boolean invertResults = StringUtils.defaultString(
- context.getParam(INVERT_RESULTS, false)).equals("on");
if (!StringUtils.isBlank(searchString)) {
log.info("SystemSearchSetupAction.getResult() calling performSearch()");
@@ -448,21 +443,7 @@ public class SystemSearchSetupAction extends RhnAction implements Listable {
return Collections.EMPTY_LIST;
}
- private String makeKey(RequestContext context) {
- DynaActionForm daForm = (DynaActionForm) context.getRequest().getAttribute(FORM);
- String searchString = daForm.getString(SEARCH_STRING);
- String viewMode = daForm.getString(VIEW_MODE);
- String whereToSearch = daForm.getString(WHERE_TO_SEARCH);
- Boolean invertResults = (Boolean) daForm.get(INVERT_RESULTS);
-
- return StringUtil.toJson(new Object [] {
- searchString, viewMode, whereToSearch, invertResults
- });
- }
-
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public String getParentUrl(RequestContext context) {
return context.getRequest().getRequestURI();
}
14 years, 12 months