java/code
by John Matthews
java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java | 63 ++++++++++
java/code/src/com/redhat/rhn/domain/errata/impl/PublishedErrata.hbm.xml | 24 +++
java/code/src/com/redhat/rhn/frontend/action/errata/ErrataSearchAction.java | 5
java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java | 13 ++
4 files changed, 103 insertions(+), 2 deletions(-)
New commits:
commit 9ae544812d7bd0cfb3a20339fe9620f168ab221e
Author: John Matthews <jmatthew(a)redhat.com>
Date: Thu May 28 15:03:46 2009 -0400
490960 - ErrataSearch limit returned results to current or trusted orgs
diff --git a/java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java b/java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java
index 7d71db7..0d6733a 100644
--- a/java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java
@@ -987,5 +987,68 @@ public class ErrataFactory extends HibernateFactory {
}
+ /**
+ * Returns a list of ErrataOverview of Errata that match the given Package
+ * ids.
+ * @param pids Package ids whose Errata are being sought.
+ * @param org Organization to match results with
+ * @return a list of ErrataOverview of Errata that match the given Package
+ * ids.
+ */
+ public static List<ErrataOverview> searchByPackageIdsWithOrg(List pids, Org org) {
+ List<Long> orgIds = new ArrayList<Long>();
+ orgIds.add(org.getId());
+ for (Org o : org.getTrustedOrgs()) {
+ orgIds.add(o.getId());
+ }
+ Map params = new HashMap();
+ params.put("pids", pids);
+ params.put("org_ids", orgIds);
+ if (log.isDebugEnabled()) {
+ log.debug("pids = " + pids);
+ log.debug("org_ids = " + orgIds);
+ }
+ List results = singleton.listObjectsByNamedQuery(
+ "PublishedErrata.searchByPackageIdsWithOrg", params);
+ if (log.isDebugEnabled()) {
+ log.debug("Query 'PublishedErrata.searchByPackageIdsWithOrg' returned " +
+ results.size() + " entries");
+ }
+ List<ErrataOverview> errata = new ArrayList<ErrataOverview>();
+ Long lastId = null;
+ ErrataOverview eo = null;
+ for (Object result : results) {
+ Object[] values = (Object[]) result;
+ // e.id, e.advisory, e.advisoryName, e.advisoryType, e.synopsis, e.updateDate
+ Long curId = (Long)values[0];
+
+ if (!curId.equals(lastId)) {
+ eo = new ErrataOverview();
+ }
+ eo.setId((Long)values[0]);
+ eo.setAdvisory((String)values[1]);
+ eo.setAdvisoryName((String)values[2]);
+ eo.setAdvisoryType((String)values[3]);
+ eo.setAdvisorySynopsis((String)values[4]);
+ eo.setUpdateDate((Date)values[5]);
+ eo.setIssueDate((Date)values[6]);
+ eo.addPackageName((String)values[7]);
+ if (!curId.equals(lastId)) {
+ errata.add(eo);
+ lastId = curId;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("curId = " + curId + ", lastId = " + lastId);
+ log.debug("ErrataOverview formed: " + eo.getAdvisoryName() + " for " +
+ eo.getPackageNames());
+ }
+ }
+
+ return errata;
+ }
+
+
+
+
}
diff --git a/java/code/src/com/redhat/rhn/domain/errata/impl/PublishedErrata.hbm.xml b/java/code/src/com/redhat/rhn/domain/errata/impl/PublishedErrata.hbm.xml
index f8c8a77..d2f19a4 100644
--- a/java/code/src/com/redhat/rhn/domain/errata/impl/PublishedErrata.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/errata/impl/PublishedErrata.hbm.xml
@@ -149,6 +149,30 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<return-scalar column="name" type="string" />
</sql-query>
+ <sql-query name="PublishedErrata.searchByPackageIdsWithOrg">
+ <![CDATA[select distinct e.id, e.advisory, e.advisory_name as advisoryName, e.advisory_type as advisoryType, e.synopsis as advisorySynopsis,
+ e.update_date as updateDate, e.issue_date as issueDate, pn.name
+ from rhnErrata e,
+ rhnErrataPackage ep,
+ rhnPackage p,
+ rhnPackageName pn
+ where e.id = ep.errata_id
+ and p.id = ep.package_id
+ and p.name_id = pn.id
+ and ep.package_id IN (:pids)
+ and e.org_id IN (:org_ids)
+ order by e.id]]>
+ <return-scalar column="id" type="long" />
+ <return-scalar column="advisory" type="string" />
+ <return-scalar column="advisoryName" type="string" />
+ <return-scalar column="advisoryType" type="string" />
+ <return-scalar column="advisorySynopsis" type="string" />
+ <return-scalar column="updateDate" type="timestamp" />
+ <return-scalar column="issueDate" type="timestamp" />
+ <return-scalar column="name" type="string" />
+ </sql-query>
+
+
<sql-query name="PublishedErrata.lookupFromSet">
<![CDATA[SELECT {e.*}
from rhnErrata e left join
diff --git a/java/code/src/com/redhat/rhn/frontend/action/errata/ErrataSearchAction.java b/java/code/src/com/redhat/rhn/frontend/action/errata/ErrataSearchAction.java
index a76467e..2ea77af 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/errata/ErrataSearchAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/errata/ErrataSearchAction.java
@@ -262,7 +262,7 @@ public class ErrataSearchAction extends RhnAction {
throws XmlRpcFault, MalformedURLException {
log.warn("Performing errata search");
-
+ RequestContext ctx = new RequestContext(request);
// call search server
XmlRpcClient client = new XmlRpcClient(Config.get().getSearchServerUrl(), true);
String path = null;
@@ -356,7 +356,8 @@ public class ErrataSearchAction extends RhnAction {
// to a better user experience.
List<ErrataOverview> unsorted = new ArrayList<ErrataOverview>();
if (OPT_PKG_NAME.equals(mode)) {
- unsorted = ErrataManager.searchByPackageIds(ids);
+ unsorted = ErrataManager.searchByPackageIdsWithOrg(ids,
+ ctx.getCurrentUser().getOrg());
}
else {
diff --git a/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java b/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
index 8ff0a6f..8b42266 100644
--- a/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
+++ b/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
@@ -31,6 +31,7 @@ import com.redhat.rhn.domain.errata.Errata;
import com.redhat.rhn.domain.errata.ErrataFactory;
import com.redhat.rhn.domain.errata.ErrataFile;
import com.redhat.rhn.domain.errata.ErrataFileType;
+import com.redhat.rhn.domain.org.Org;
import com.redhat.rhn.domain.rhnset.RhnSet;
import com.redhat.rhn.domain.role.RoleFactory;
import com.redhat.rhn.domain.user.User;
@@ -292,6 +293,18 @@ public class ErrataManager extends BaseManager {
}
/**
+ * Returns a list of ErrataOverview whose errata contains the packages
+ * with the given pids.
+ * @param pids list of package ids whose errata are sought.
+ * @param org Organization to match results with
+ * @return a list of ErrataOverview whose errata contains the packages
+ * with the given pids.
+ */
+ public static List<ErrataOverview> searchByPackageIdsWithOrg(List pids, Org org) {
+ return ErrataFactory.searchByPackageIdsWithOrg(pids, org);
+ }
+
+ /**
* Returns a list of ErrataOverview matching the given errata ids.
* @param eids Errata ids sought.
* @return a list of ErrataOverview matching the given errata ids.
14 years, 11 months
Branch 'VADER' - backend/server
by Pradeep Kilambi
backend/server/rhnServer/server_lib.py | 12 ------------
1 file changed, 12 deletions(-)
New commits:
commit a9c90b9a1bc6dce420582abe5727f39eac76e0e2
Author: Pradeep Kilambi <pkilambi(a)redhat.com>
Date: Thu May 28 14:37:32 2009 -0400
removing some unused hosted stuff
diff --git a/backend/server/rhnServer/server_lib.py b/backend/server/rhnServer/server_lib.py
index 7fc4c24..7cd7a59 100644
--- a/backend/server/rhnServer/server_lib.py
+++ b/backend/server/rhnServer/server_lib.py
@@ -37,18 +37,6 @@ class rhnSystemEntitlementException(rhnException):
class rhnNoSystemEntitlementsException(rhnSystemEntitlementException):
pass
-
-freeloader_throttle_msg = """
- In order to provide a higher level of service to our paying
- customers, demo accounts may not use the up2date service between
- the hours of %(end_free_time)s and %(start_free_time)s Eastern US time.
-
- To purchase Red Hat Network service, visit:
-
- https://rhn.redhat.com/network/sales/index.pxt
-
- Your account name: %(login)s"""
-
def use_registration_number(user, registration_number, commit=1):
log_debug(3, registration_number)
if registration_number is None:
14 years, 11 months
client/rhel
by Pradeep Kilambi
client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
New commits:
commit f1fe8a1047678be9d0e63144d68cf94b79fe18a7
Author: James Bowes <jbowes(a)redhat.com>
Date: Thu May 28 10:48:33 2009 -0400
Send smbios data to remaining_subscriptions during registration
For KVM or other non Xen virt types, rhn_register needs to send smbios
info during a call to remaining_subscriptions, in case the user has no
free channel entitlements, but would be granted a free for guest
entitlement.
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
index 4e1b3be..ea4bf0f 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg.py
@@ -576,15 +576,19 @@ def getRemainingSubscriptions(username, password):
# If we've gotten this far, we're definitely looking at hosted.
# Hosted will have to support the sending of the release, and optionally,
# the virt_uuid.
- if virt_uuid is not None:
+
+ if cfg['supportsSMBIOS']:
+ smbios = hardware.get_hal_smbios()
subs = s.registration.remaining_subscriptions(username, password,
arch,
release,
- virt_uuid)
+ virt_uuid,
+ smbios)
else:
subs = s.registration.remaining_subscriptions(username, password,
arch,
- release)
+ release,
+ virt_uuid)
log.log_debug('Server returned %s' % subs)
14 years, 11 months
backend/server
by Pradeep Kilambi
backend/server/rhnServer/server_lib.py | 12 ------------
1 file changed, 12 deletions(-)
New commits:
commit a81260830849fca5cde331a1f9326f65a6ad38da
Author: Pradeep Kilambi <pkilambi(a)redhat.com>
Date: Thu May 28 14:37:32 2009 -0400
removing some unused hosted stuff
diff --git a/backend/server/rhnServer/server_lib.py b/backend/server/rhnServer/server_lib.py
index 7fc4c24..7cd7a59 100644
--- a/backend/server/rhnServer/server_lib.py
+++ b/backend/server/rhnServer/server_lib.py
@@ -37,18 +37,6 @@ class rhnSystemEntitlementException(rhnException):
class rhnNoSystemEntitlementsException(rhnSystemEntitlementException):
pass
-
-freeloader_throttle_msg = """
- In order to provide a higher level of service to our paying
- customers, demo accounts may not use the up2date service between
- the hours of %(end_free_time)s and %(start_free_time)s Eastern US time.
-
- To purchase Red Hat Network service, visit:
-
- https://rhn.redhat.com/network/sales/index.pxt
-
- Your account name: %(login)s"""
-
def use_registration_number(user, registration_number, commit=1):
log_debug(3, registration_number)
if registration_number is None:
14 years, 11 months
Branch 'VADER' - 2 commits - java/code
by Brad Buckingham
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml | 6 +
java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelLabelException.java | 21 +++++-
java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelNameException.java | 19 +++++
java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java | 34 +++++++---
4 files changed, 69 insertions(+), 11 deletions(-)
New commits:
commit 02dd7b9921975b03cab43aa14feb36ecb3cb5abb
Author: Brad Buckingham <bbuckingham(a)redhat.com>
Date: Thu May 28 14:05:05 2009 -0400
remove todo indicator from code
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index aebe65c..4f6af70 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -8106,7 +8106,6 @@ Follow this url to see the full list of inactive systems:
<context context-type="sourcefile">/channels/manage/Edit</context>
</context-group>
</trans-unit>
- BRAD
<trans-unit id="edit.channel.invalidchannelname.supportedregex">
<source>Channel name must begin with a letter and may contain only lowercase letters, hyphens ('-'), periods ('.'), underscores ('_'), numerals, spaces and forward slashes ('/').</source>
</trans-unit>
commit bf2cfbe641761e7f184c36c7814c3e3c4a922658
Author: Brad Buckingham <bbuckingham(a)redhat.com>
Date: Thu May 28 14:03:27 2009 -0400
501358 - api - channel.software.create - update to provide more detail on label/name errors
Currently, when executing the API, if an error exists with either channel label
or name, the exception message is similar to:
Invalid channel label
Invalid channel name
Recently, modifications were made to the UI to provide more descriptive
information for these name/label errors. As a result, updating the API to
use the same/similar messages.
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index 23b593d..aebe65c 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -8106,6 +8106,10 @@ Follow this url to see the full list of inactive systems:
<context context-type="sourcefile">/channels/manage/Edit</context>
</context-group>
</trans-unit>
+ BRAD
+ <trans-unit id="edit.channel.invalidchannelname.supportedregex">
+ <source>Channel name must begin with a letter and may contain only lowercase letters, hyphens ('-'), periods ('.'), underscores ('_'), numerals, spaces and forward slashes ('/').</source>
+ </trans-unit>
<trans-unit id="edit.channel.invalidchannelname.redhat">
<source>Red Hat channels require admin privileges</source>
<context-group name="ctx">
@@ -8143,6 +8147,9 @@ Follow this url to see the full list of inactive systems:
<context context-type="sourcefile">/channels/manage/Edit</context>
</context-group>
</trans-unit>
+ <trans-unit id="edit.channel.invalidchannellabel.supportedregex">
+ <source>Channel label must begin with a letter and may contain only lowercase letters, hyphens ('-'), periods ('.'), underscores ('_'), and numerals.</source>
+ </trans-unit>
<trans-unit id="edit.channel.invalidchannellabel.redhat">
<source>Red Hat channels require admin privileges</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelLabelException.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelLabelException.java
index 21f4df6..763b69e 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelLabelException.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelLabelException.java
@@ -49,7 +49,7 @@ public class InvalidChannelLabelException extends FaultException {
}
/**
- * Creates a new indication that a given channel name is invalid and
+ * Creates a new indication that a given channel label is invalid
*
* @param labelIn label the user attempted to give the channel
* @param reasonIn flag indicating why the channel name is invalid; cannot be
@@ -63,6 +63,25 @@ public class InvalidChannelLabelException extends FaultException {
}
/**
+ * Creates a new indication that a given channel label is invalid
+ *
+ * @param labelIn label the user attempted to give the channel
+ * @param reasonIn flag indicating why the channel name is invalid; cannot be
+ * <code>null</code>
+ * @param messageIdIn the string resource message ID
+ * @param argIn an optional argument that is associated with messageId. If there
+ * is no argument, pass in an empty string.
+ */
+ public InvalidChannelLabelException(String labelIn, Reason reasonIn,
+ String messageIdIn, String argIn) {
+
+ super(1201, "invalidChannelLabel", messageIdIn, new Object[] {argIn});
+
+ this.label = labelIn;
+ this.reason = reasonIn;
+ }
+
+ /**
* @return invalid label that caused this exception; may be <code>null</code>
*/
public String getLabel() {
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelNameException.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelNameException.java
index 8702d68..a1d1b07 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelNameException.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelNameException.java
@@ -63,6 +63,25 @@ public class InvalidChannelNameException extends FaultException {
}
/**
+ * Creates a new indication that a given channel name is invalid.
+ *
+ * @param nameIn name the user attempted to give the channel
+ * @param reasonIn flag indicating why the channel name is invalid; cannot be
+ * <code>null</code>
+ * @param messageIdIn the string resource message ID
+ * @param argIn an optional argument that is associated with messageId. If there
+ * is no argument, pass in an empty string.
+ */
+ public InvalidChannelNameException(String nameIn, Reason reasonIn,
+ String messageIdIn, String argIn) {
+
+ super(1200, "invalidChannelName", messageIdIn, new Object[] {argIn});
+
+ this.name = nameIn;
+ this.reason = reasonIn;
+ }
+
+ /**
* @return invalid name that caused this exception; may be <code>null</code>
*/
public String getName() {
diff --git a/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java b/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
index c3ff972..8ee65e9 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
@@ -223,12 +223,14 @@ public class CreateChannelCommand {
if (ChannelFactory.doesChannelNameExist(name)) {
throw new InvalidChannelNameException(name,
- InvalidChannelNameException.Reason.NAME_IN_USE);
+ InvalidChannelNameException.Reason.NAME_IN_USE,
+ "edit.channel.invalidchannelname.nameinuse", name);
}
if (ChannelFactory.doesChannelLabelExist(label)) {
throw new InvalidChannelLabelException(label,
- InvalidChannelLabelException.Reason.LABEL_IN_USE);
+ InvalidChannelLabelException.Reason.LABEL_IN_USE,
+ "edit.channel.invalidchannellabel.labelinuse", label);
}
ChannelArch ca = ChannelFactory.findArchByLabel(archLabel);
@@ -326,17 +328,22 @@ public class CreateChannelCommand {
if (cname == null || cname.trim().length() == 0) {
throw new InvalidChannelNameException(cname,
- InvalidChannelNameException.Reason.IS_MISSING);
+ InvalidChannelNameException.Reason.IS_MISSING,
+ "edit.channel.invalidchannelname.missing", "");
}
if (!Pattern.compile(CHANNEL_NAME_REGEX).matcher(cname).find()) {
throw new InvalidChannelNameException(cname,
- InvalidChannelNameException.Reason.REGEX_FAILS);
+ InvalidChannelNameException.Reason.REGEX_FAILS,
+ "edit.channel.invalidchannelname.supportedregex", "");
}
if (cname.length() < CHANNEL_NAME_MIN_LENGTH) {
+ Integer minLength = new Integer(CreateChannelCommand.CHANNEL_NAME_MIN_LENGTH);
throw new InvalidChannelNameException(cname,
- InvalidChannelNameException.Reason.TOO_SHORT);
+ InvalidChannelNameException.Reason.TOO_SHORT,
+ "edit.channel.invalidchannelname.minlength",
+ minLength.toString());
}
// the perl code used to ignore case with a /i at the end of
@@ -345,7 +352,8 @@ public class CreateChannelCommand {
if (!user.hasRole(RoleFactory.RHN_SUPERUSER) &&
Pattern.compile(REDHAT_REGEX).matcher(cname.toLowerCase()).find()) {
throw new InvalidChannelNameException(cname,
- InvalidChannelNameException.Reason.RHN_CHANNEL_BAD_PERMISSIONS);
+ InvalidChannelNameException.Reason.RHN_CHANNEL_BAD_PERMISSIONS,
+ "edit.channel.invalidchannelname.redhat", "");
}
}
@@ -358,17 +366,22 @@ public class CreateChannelCommand {
if (clabel == null || clabel.trim().length() == 0) {
throw new InvalidChannelLabelException(clabel,
- InvalidChannelLabelException.Reason.IS_MISSING);
+ InvalidChannelLabelException.Reason.IS_MISSING,
+ "edit.channel.invalidchannellabel.missing", "");
}
if (!Pattern.compile(CHANNEL_LABEL_REGEX).matcher(clabel).find()) {
throw new InvalidChannelLabelException(clabel,
- InvalidChannelLabelException.Reason.REGEX_FAILS);
+ InvalidChannelLabelException.Reason.REGEX_FAILS,
+ "edit.channel.invalidchannellabel.supportedregex", "");
}
if (clabel.length() < CHANNEL_LABEL_MIN_LENGTH) {
+ Integer minLength = new Integer(CreateChannelCommand.CHANNEL_LABEL_MIN_LENGTH);
throw new InvalidChannelLabelException(clabel,
- InvalidChannelLabelException.Reason.TOO_SHORT);
+ InvalidChannelLabelException.Reason.TOO_SHORT,
+ "edit.channel.invalidchannellabel.minlength",
+ minLength.toString());
}
// the perl code used to ignore case with a /i at the end of
@@ -377,7 +390,8 @@ public class CreateChannelCommand {
if (!user.hasRole(RoleFactory.RHN_SUPERUSER) &&
Pattern.compile(REDHAT_REGEX).matcher(clabel.toLowerCase()).find()) {
throw new InvalidChannelLabelException(clabel,
- InvalidChannelLabelException.Reason.RHN_CHANNEL_BAD_PERMISSIONS);
+ InvalidChannelLabelException.Reason.RHN_CHANNEL_BAD_PERMISSIONS,
+ "edit.channel.invalidchannellabel.redhat", "");
}
}
14 years, 11 months
java/code
by Brad Buckingham
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml | 1 -
1 file changed, 1 deletion(-)
New commits:
commit 3abc1cb0a7d8babe8f192e17cff64b0a044b6757
Author: Brad Buckingham <bbuckingham(a)redhat.com>
Date: Thu May 28 14:05:05 2009 -0400
remove todo indicator from code
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index aebe65c..4f6af70 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -8106,7 +8106,6 @@ Follow this url to see the full list of inactive systems:
<context context-type="sourcefile">/channels/manage/Edit</context>
</context-group>
</trans-unit>
- BRAD
<trans-unit id="edit.channel.invalidchannelname.supportedregex">
<source>Channel name must begin with a letter and may contain only lowercase letters, hyphens ('-'), periods ('.'), underscores ('_'), numerals, spaces and forward slashes ('/').</source>
</trans-unit>
14 years, 11 months
java/code
by Brad Buckingham
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml | 7 ++
java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelLabelException.java | 21 +++++-
java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelNameException.java | 19 +++++
java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java | 34 +++++++---
4 files changed, 70 insertions(+), 11 deletions(-)
New commits:
commit 006a7c03de8e0e5a6fd2b2bda6e53b749b465dac
Author: Brad Buckingham <bbuckingham(a)redhat.com>
Date: Thu May 28 14:03:27 2009 -0400
501358 - api - channel.software.create - update to provide more detail on label/name errors
Currently, when executing the API, if an error exists with either channel label
or name, the exception message is similar to:
Invalid channel label
Invalid channel name
Recently, modifications were made to the UI to provide more descriptive
information for these name/label errors. As a result, updating the API to
use the same/similar messages.
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index 23b593d..aebe65c 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -8106,6 +8106,10 @@ Follow this url to see the full list of inactive systems:
<context context-type="sourcefile">/channels/manage/Edit</context>
</context-group>
</trans-unit>
+ BRAD
+ <trans-unit id="edit.channel.invalidchannelname.supportedregex">
+ <source>Channel name must begin with a letter and may contain only lowercase letters, hyphens ('-'), periods ('.'), underscores ('_'), numerals, spaces and forward slashes ('/').</source>
+ </trans-unit>
<trans-unit id="edit.channel.invalidchannelname.redhat">
<source>Red Hat channels require admin privileges</source>
<context-group name="ctx">
@@ -8143,6 +8147,9 @@ Follow this url to see the full list of inactive systems:
<context context-type="sourcefile">/channels/manage/Edit</context>
</context-group>
</trans-unit>
+ <trans-unit id="edit.channel.invalidchannellabel.supportedregex">
+ <source>Channel label must begin with a letter and may contain only lowercase letters, hyphens ('-'), periods ('.'), underscores ('_'), and numerals.</source>
+ </trans-unit>
<trans-unit id="edit.channel.invalidchannellabel.redhat">
<source>Red Hat channels require admin privileges</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelLabelException.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelLabelException.java
index 21f4df6..763b69e 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelLabelException.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelLabelException.java
@@ -49,7 +49,7 @@ public class InvalidChannelLabelException extends FaultException {
}
/**
- * Creates a new indication that a given channel name is invalid and
+ * Creates a new indication that a given channel label is invalid
*
* @param labelIn label the user attempted to give the channel
* @param reasonIn flag indicating why the channel name is invalid; cannot be
@@ -63,6 +63,25 @@ public class InvalidChannelLabelException extends FaultException {
}
/**
+ * Creates a new indication that a given channel label is invalid
+ *
+ * @param labelIn label the user attempted to give the channel
+ * @param reasonIn flag indicating why the channel name is invalid; cannot be
+ * <code>null</code>
+ * @param messageIdIn the string resource message ID
+ * @param argIn an optional argument that is associated with messageId. If there
+ * is no argument, pass in an empty string.
+ */
+ public InvalidChannelLabelException(String labelIn, Reason reasonIn,
+ String messageIdIn, String argIn) {
+
+ super(1201, "invalidChannelLabel", messageIdIn, new Object[] {argIn});
+
+ this.label = labelIn;
+ this.reason = reasonIn;
+ }
+
+ /**
* @return invalid label that caused this exception; may be <code>null</code>
*/
public String getLabel() {
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelNameException.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelNameException.java
index 8702d68..a1d1b07 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelNameException.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidChannelNameException.java
@@ -63,6 +63,25 @@ public class InvalidChannelNameException extends FaultException {
}
/**
+ * Creates a new indication that a given channel name is invalid.
+ *
+ * @param nameIn name the user attempted to give the channel
+ * @param reasonIn flag indicating why the channel name is invalid; cannot be
+ * <code>null</code>
+ * @param messageIdIn the string resource message ID
+ * @param argIn an optional argument that is associated with messageId. If there
+ * is no argument, pass in an empty string.
+ */
+ public InvalidChannelNameException(String nameIn, Reason reasonIn,
+ String messageIdIn, String argIn) {
+
+ super(1200, "invalidChannelName", messageIdIn, new Object[] {argIn});
+
+ this.name = nameIn;
+ this.reason = reasonIn;
+ }
+
+ /**
* @return invalid name that caused this exception; may be <code>null</code>
*/
public String getName() {
diff --git a/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java b/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
index c3ff972..8ee65e9 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
@@ -223,12 +223,14 @@ public class CreateChannelCommand {
if (ChannelFactory.doesChannelNameExist(name)) {
throw new InvalidChannelNameException(name,
- InvalidChannelNameException.Reason.NAME_IN_USE);
+ InvalidChannelNameException.Reason.NAME_IN_USE,
+ "edit.channel.invalidchannelname.nameinuse", name);
}
if (ChannelFactory.doesChannelLabelExist(label)) {
throw new InvalidChannelLabelException(label,
- InvalidChannelLabelException.Reason.LABEL_IN_USE);
+ InvalidChannelLabelException.Reason.LABEL_IN_USE,
+ "edit.channel.invalidchannellabel.labelinuse", label);
}
ChannelArch ca = ChannelFactory.findArchByLabel(archLabel);
@@ -326,17 +328,22 @@ public class CreateChannelCommand {
if (cname == null || cname.trim().length() == 0) {
throw new InvalidChannelNameException(cname,
- InvalidChannelNameException.Reason.IS_MISSING);
+ InvalidChannelNameException.Reason.IS_MISSING,
+ "edit.channel.invalidchannelname.missing", "");
}
if (!Pattern.compile(CHANNEL_NAME_REGEX).matcher(cname).find()) {
throw new InvalidChannelNameException(cname,
- InvalidChannelNameException.Reason.REGEX_FAILS);
+ InvalidChannelNameException.Reason.REGEX_FAILS,
+ "edit.channel.invalidchannelname.supportedregex", "");
}
if (cname.length() < CHANNEL_NAME_MIN_LENGTH) {
+ Integer minLength = new Integer(CreateChannelCommand.CHANNEL_NAME_MIN_LENGTH);
throw new InvalidChannelNameException(cname,
- InvalidChannelNameException.Reason.TOO_SHORT);
+ InvalidChannelNameException.Reason.TOO_SHORT,
+ "edit.channel.invalidchannelname.minlength",
+ minLength.toString());
}
// the perl code used to ignore case with a /i at the end of
@@ -345,7 +352,8 @@ public class CreateChannelCommand {
if (!user.hasRole(RoleFactory.RHN_SUPERUSER) &&
Pattern.compile(REDHAT_REGEX).matcher(cname.toLowerCase()).find()) {
throw new InvalidChannelNameException(cname,
- InvalidChannelNameException.Reason.RHN_CHANNEL_BAD_PERMISSIONS);
+ InvalidChannelNameException.Reason.RHN_CHANNEL_BAD_PERMISSIONS,
+ "edit.channel.invalidchannelname.redhat", "");
}
}
@@ -358,17 +366,22 @@ public class CreateChannelCommand {
if (clabel == null || clabel.trim().length() == 0) {
throw new InvalidChannelLabelException(clabel,
- InvalidChannelLabelException.Reason.IS_MISSING);
+ InvalidChannelLabelException.Reason.IS_MISSING,
+ "edit.channel.invalidchannellabel.missing", "");
}
if (!Pattern.compile(CHANNEL_LABEL_REGEX).matcher(clabel).find()) {
throw new InvalidChannelLabelException(clabel,
- InvalidChannelLabelException.Reason.REGEX_FAILS);
+ InvalidChannelLabelException.Reason.REGEX_FAILS,
+ "edit.channel.invalidchannellabel.supportedregex", "");
}
if (clabel.length() < CHANNEL_LABEL_MIN_LENGTH) {
+ Integer minLength = new Integer(CreateChannelCommand.CHANNEL_LABEL_MIN_LENGTH);
throw new InvalidChannelLabelException(clabel,
- InvalidChannelLabelException.Reason.TOO_SHORT);
+ InvalidChannelLabelException.Reason.TOO_SHORT,
+ "edit.channel.invalidchannellabel.minlength",
+ minLength.toString());
}
// the perl code used to ignore case with a /i at the end of
@@ -377,7 +390,8 @@ public class CreateChannelCommand {
if (!user.hasRole(RoleFactory.RHN_SUPERUSER) &&
Pattern.compile(REDHAT_REGEX).matcher(clabel.toLowerCase()).find()) {
throw new InvalidChannelLabelException(clabel,
- InvalidChannelLabelException.Reason.RHN_CHANNEL_BAD_PERMISSIONS);
+ InvalidChannelLabelException.Reason.RHN_CHANNEL_BAD_PERMISSIONS,
+ "edit.channel.invalidchannellabel.redhat", "");
}
}
14 years, 11 months
Branch 'VADER' - java/code
by Partha Aji
java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
New commits:
commit df3db24929d35f162db0ee3433226c1cd685178f
Author: Partha Aji <paji(a)redhat.com>
Date: Thu May 28 13:04:43 2009 -0400
Corrected Virt type equality check
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 5dc2056..1dcf2e5 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
@@ -20,6 +20,7 @@ import com.redhat.rhn.domain.kickstart.KickstartCommand;
import com.redhat.rhn.domain.kickstart.KickstartData;
import com.redhat.rhn.domain.kickstart.KickstartScript;
import com.redhat.rhn.domain.kickstart.KickstartSession;
+import com.redhat.rhn.domain.kickstart.KickstartVirtualizationType;
import com.redhat.rhn.domain.kickstart.RepoInfo;
import com.redhat.rhn.domain.kickstart.cobbler.CobblerSnippet;
import com.redhat.rhn.domain.kickstart.crypto.CryptoKey;
@@ -388,8 +389,8 @@ public class KickstartFormatter {
for (Iterator itr = ksdata.getPackageNames().iterator(); itr.hasNext();) {
buf.append(((PackageName)itr.next()).getName() + NEWLINE);
}
- if (ksdata.getKickstartDefaults().
- getVirtualizationType().getLabel().equals("para_host")) {
+ if (KickstartVirtualizationType.paraHost().equals(ksdata.getKickstartDefaults().
+ getVirtualizationType())) {
buf.append("kernel-xen" + NEWLINE);
buf.append("xen" + NEWLINE);
}
14 years, 11 months
java/code
by Partha Aji
java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
New commits:
commit 4a73c7f4914ac477ca91a7342b74755fe172ef6a
Author: Partha Aji <paji(a)redhat.com>
Date: Thu May 28 13:04:43 2009 -0400
Corrected Virt type equality check
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 8ed6cb3..5c8d3c1 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
@@ -20,6 +20,7 @@ import com.redhat.rhn.domain.kickstart.KickstartCommand;
import com.redhat.rhn.domain.kickstart.KickstartData;
import com.redhat.rhn.domain.kickstart.KickstartScript;
import com.redhat.rhn.domain.kickstart.KickstartSession;
+import com.redhat.rhn.domain.kickstart.KickstartVirtualizationType;
import com.redhat.rhn.domain.kickstart.RepoInfo;
import com.redhat.rhn.domain.kickstart.cobbler.CobblerSnippet;
import com.redhat.rhn.domain.kickstart.crypto.CryptoKey;
@@ -388,8 +389,8 @@ public class KickstartFormatter {
for (Iterator itr = ksdata.getPackageNames().iterator(); itr.hasNext();) {
buf.append(((PackageName)itr.next()).getName() + NEWLINE);
}
- if (ksdata.getKickstartDefaults().
- getVirtualizationType().getLabel().equals("para_host")) {
+ if (KickstartVirtualizationType.paraHost().equals(ksdata.getKickstartDefaults().
+ getVirtualizationType())) {
buf.append("kernel-xen" + NEWLINE);
buf.append("xen" + NEWLINE);
}
14 years, 11 months
Branch 'VADER' - spacewalk/setup
by Miroslav Suchý
spacewalk/setup/bin/spacewalk-setup | 3 +++
1 file changed, 3 insertions(+)
New commits:
commit 0585800ce135717425e7f363df14593bc9a8f908
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu May 28 18:51:56 2009 +0200
502475 - add ip address to SatCluster and SatNode
(cherry picked from commit 52bb80717fca3c034b8cc41324aa851a7b637968)
diff --git a/spacewalk/setup/bin/spacewalk-setup b/spacewalk/setup/bin/spacewalk-setup
index 952667a..4fe73c2 100644
--- a/spacewalk/setup/bin/spacewalk-setup
+++ b/spacewalk/setup/bin/spacewalk-setup
@@ -42,6 +42,7 @@ use Fcntl qw(F_GETFD F_SETFD FD_CLOEXEC);
use RHN::SatInstall;
use RHN::SatCluster;
use RHN::DB;
+use RHN::Utils;
my $DEBUG;
$DEBUG = 0;
@@ -1119,10 +1120,12 @@ sub setup_monitoring {
$scout = RHN::SatCluster->lookup(-recid => 1);
};
if ($@) { #scout does not exist, lets create new
+ my $ip_addr = RHN::Utils::find_ip_address($answers->{'hostname'});
my $org_id = RHN::SatInstall->get_satellite_org_id();
$scout = new RHN::SatCluster(customer_id => $org_id,
description => 'RHN Monitoring Satellite',
last_update_user => 'installer',
+ vip => $ip_addr,
);
$scout->create_new();
} else {
14 years, 11 months