Hello all,

Attached is a patch to correctly display the number of files, dirs, and symlinks successfully compared to and differing from Spacewalk.

The second patch makes the diff output sent to Spacewalk (from config files with differences) appear in a fixed-width font in the webUI.

Also attached is a patch that we're currently using locally to allow us to have channels that start with "Red Hat" etc.

Thanks,

Joshua Roys
>From 2b62ce8369a60da86e856942e289239bff7adc64 Mon Sep 17 00:00:00 2001
From: Joshua Roys <[email protected]>
Date: Fri, 18 Sep 2009 14:40:49 -0400
Subject: [PATCH] Fix system comparison file/dir/symlink counts

---
 .../action/configuration/sdc/OverviewAction.java   |   36 ++---
 .../frontend/strings/java/StringResource_en_US.xml |  164 ++++++++++++++------
 2 files changed, 131 insertions(+), 69 deletions(-)

diff --git 
a/java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
 
b/java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
index 9403841..2c08ef9 100644
--- 
a/java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
+++ 
b/java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
@@ -275,30 +275,21 @@ public class OverviewAction extends RhnAction {
             ConfigFileCount differing,
             String url) {
 
-        int filesSuffix = getSuffix(total.getFiles() + total.getSymlinks());
+        int filesSuffix = getSuffix(total.getFiles());
         int dirsSuffix = getSuffix(total.getDirectories());
+        int symlinksSuffix = getSuffix(total.getSymlinks());
 
         String messageKey = DIFF_ACTION_MESSAGE_PREFIX +
-            filesSuffix + "_dirs_" + dirsSuffix;
+            filesSuffix + "_dirs_" + dirsSuffix + "_symlinks_" + 
symlinksSuffix;
 
         List params = new ArrayList();
         // setup the params
-        if (filesSuffix == PLURAL) {
-            params.add(String.valueOf(successful.getFiles() + 
successful.getSymlinks()));
-            params.add(String.valueOf(total.getFiles() + total.getSymlinks()));
-        }
-        else if (filesSuffix == SINGULAR) {
-            params.add(String.valueOf(successful.getFiles() + 
successful.getSymlinks()));
-        }
-
-        if (dirsSuffix == PLURAL) {
-            params.add(String.valueOf(successful.getDirectories()));
-            params.add(String.valueOf(total.getDirectories()));
-        }
-        else if (dirsSuffix == SINGULAR) {
-            params.add(String.valueOf(successful.getDirectories()));
-        }
-
+        params.add(String.valueOf(successful.getFiles()));
+        params.add(String.valueOf(total.getFiles()));
+        params.add(String.valueOf(successful.getDirectories()));
+        params.add(String.valueOf(total.getDirectories()));
+        params.add(String.valueOf(successful.getSymlinks()));
+        params.add(String.valueOf(total.getSymlinks()));
         params.add(url);
 
         LocalizationService service  = LocalizationService.getInstance();
@@ -306,9 +297,10 @@ public class OverviewAction extends RhnAction {
             request.setAttribute(DIFF_ACTION_MESSAGE,
                     service.getMessage(messageKey));
         }
-        request.setAttribute(DIFF_ACTION_MESSAGE,
-                service.getMessage(messageKey,
-                    params.toArray()));
+        else {
+            request.setAttribute(DIFF_ACTION_MESSAGE,
+                    service.getMessage(messageKey, params.toArray()));
+        }
 
         if (successful.getFiles() + successful.getSymlinks() > 0) {
             String diffActionKey;
@@ -327,7 +319,7 @@ public class OverviewAction extends RhnAction {
                 else {
                     Object [] keyParams = new Object[] {
                         String.valueOf(differing.getFiles() + 
differing.getSymlinks()),
-                            String.valueOf(successful.getFiles() + 
successful.getSymlinks())
+                        String.valueOf(successful.getFiles() + 
successful.getSymlinks())
                     };
                     request.setAttribute(DIFF_DETAILS_MESSAGE,
                             service.getMessage(diffActionKey, keyParams));
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 99028dd..fc5d8d0 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
@@ -7108,57 +7108,127 @@ Follow this url to see the full list of inactive 
systems:
             <trans-unit id="sdc.config.diff.noaction">
                        <source>No system comparisons completed. [&lt;a 
href=&quot;{0}&quot;&gt;Schedule System Comparison&lt;/a&gt;]</source>
         </trans-unit>
-            <trans-unit id="sdc.config.diff.files_0_dirs_0">
-                       <source>No files or directories were selected for 
comparison. [&lt;a href=&quot;{0}&quot;&gt; View Details&lt;/a&gt;]</source>
-            </trans-unit>
 
-            <trans-unit id="sdc.config.diff.files_1_dirs_0">
-<source>{0} of 1 file on the system was successfully compared with 
@@PRODUCT_NAME@@-Managed files and directories. [&lt;a href=&quot;{1}&quot;&gt; 
View Details&lt;/a&gt;]</source>
-            </trans-unit>
-                      
-                        
-            <trans-unit id="sdc.config.diff.files_2_dirs_0">
-             <source>{0} of {1} files on the system were successfully compared 
with @@PRODUCT_NAME@@-Managed files and directories. [&lt;a 
href=&quot;{2}&quot;&gt; View Details&lt;/a&gt;]</source>
-         </trans-unit>
-                      
+       <trans-unit id="sdc.config.diff.files_0_dirs_0_symlinks_0">
+               <source>No files, directories or symlinks were selected for 
comparison. [&lt;a href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
 
-            <trans-unit id="sdc.config.diff.files_0_dirs_1">
-<source>{0} of 1 directory on the system was successfully compared with 
@@PRODUCT_NAME@@-Managed files and directories. [&lt;a href=&quot;{1}&quot;&gt; 
View Details&lt;/a&gt;]</source>
-            </trans-unit>
-                      
-                        
-            <trans-unit id="sdc.config.diff.files_0_dirs_2">
-             <source>{0} of {1} directories on the system were successfully 
compared with @@PRODUCT_NAME@@-Managed files and directories. [&lt;a 
href=&quot;{2}&quot;&gt; View Details&lt;/a&gt;]</source>
-         </trans-unit>
+       <trans-unit id="sdc.config.diff.files_0_dirs_0_symlinks_1">
+               <source>{4} of 1 symlink on the system was successfully 
compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
 
-            <trans-unit id="sdc.config.diff.files_1_dirs_1">
-<source>{0} of 1  file and {1} of 1 directory on the system was successfully 
compared with @@PRODUCT_NAME@@-Managed files and directories. [&lt;a 
href=&quot;{2}&quot;&gt; View Details&lt;/a&gt;]</source>
-            </trans-unit>
-                      
-                        
-            <trans-unit id="sdc.config.diff.files_1_dirs_2">
-             <source>{0} of 1 file and {1} of {2} directories on the system 
were successfully compared with @@PRODUCT_NAME@@-Managed files and directories. 
[&lt;a href=&quot;{3}&quot;&gt; View Details&lt;/a&gt;]</source>
-         </trans-unit>
-                
-            <trans-unit id="sdc.config.diff.files_2_dirs_1">
-             <source>{0} of {1} files and {2} of 1 directory on the system 
were successfully compared with @@PRODUCT_NAME@@-Managed files and directories. 
[&lt;a href=&quot;{3}&quot;&gt; View Details&lt;/a&gt;]</source>
-         </trans-unit>
-                                
-            <trans-unit id="sdc.config.diff.files_2_dirs_2">
-             <source>{0} of {1} files and {2} of 1 directory on the system 
were successfully compared with @@PRODUCT_NAME@@-Managed files and directories. 
[&lt;a href=&quot;{3}&quot;&gt; View Details&lt;/a&gt;]</source>
-         </trans-unit>      
-
-            <trans-unit id="sdc.config.differing.files_0">
-                       <source>No existing files in the existing system 
differed from the @@PRODUCT_NAME@@-Managed files.</source>
+       <trans-unit id="sdc.config.diff.files_0_dirs_0_symlinks_2">
+               <source>{4} of {5} symlinks on the system were successfully 
compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_0_dirs_1_symlinks_0">
+               <source>{2} of 1 directory on the system was successfully 
compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_0_dirs_1_symlinks_1">
+               <source>{2} of 1 directory and {4} of 1 symlink on the system 
were successfully compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_0_dirs_1_symlinks_2">
+               <source>{2} of 1 directory and {4} of {5} symlinks on the 
system were successfully compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_0_dirs_2_symlinks_0">
+               <source>{2} of {3} directories on the system were successfully 
compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_0_dirs_2_symlinks_1">
+               <source>{2} of {3} directories and {4} of 1 symlink on the 
system were successfully compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_0_dirs_2_symlinks_2">
+               <source>{2} of {3} directories and {4} of {5} symlinks on the 
system were successfully compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_1_dirs_0_symlinks_0">
+               <source>{0} of 1 file on the system was successfully compared 
with @@PRODUCT_NAME@@-Managed files. [&lt;a href=&quot;{6}&quot;&gt;View 
Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_1_dirs_0_symlinks_1">
+               <source>{0} of 1 file and {4} of 1 symlink on the system were 
successfully compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_1_dirs_0_symlinks_2">
+               <source>{0} of 1 file and {4} of {5} symlinks on the system 
were successfully compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_1_dirs_1_symlinks_0">
+               <source>{0} of 1 file and {2} of 1 directory on the system were 
successfully compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_1_dirs_1_symlinks_1">
+               <source>{0} of 1 file and {2} of 1 directory and {4} of 1 
symlink on the system were successfully compared with @@PRODUCT_NAME@@-Managed 
files. [&lt;a href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_1_dirs_1_symlinks_2">
+               <source>{0} of 1 file and {2} of 1 directory and {4} of {5} 
symlinks on the system were successfully compared with @@PRODUCT_NAME@@-Managed 
files. [&lt;a href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_1_dirs_2_symlinks_0">
+               <source>{0} of 1 file and {2} of {3} directories on the system 
were successfully compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_1_dirs_2_symlinks_1">
+               <source>{0} of 1 file and {2} of {3} directories and {4} of 1 
symlink on the system were successfully compared with @@PRODUCT_NAME@@-Managed 
files. [&lt;a href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_1_dirs_2_symlinks_2">
+               <source>{0} of 1 file and {2} of {3} directories and {4} of {5} 
symlinks on the system were successfully compared with @@PRODUCT_NAME@@-Managed 
files. [&lt;a href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_2_dirs_0_symlinks_0">
+               <source>{0} of {1} files on the system were successfully 
compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_2_dirs_0_symlinks_1">
+               <source>{0} of {1} files and {4} of 1 symlink on the system 
were successfully compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_2_dirs_0_symlinks_2">
+               <source>{0} of {1} files and {4} of {5} symlinks on the system 
were successfully compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_2_dirs_1_symlinks_0">
+               <source>{0} of {1} files and {2} of 1 directory on the system 
were successfully compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_2_dirs_1_symlinks_1">
+               <source>{0} of {1} files and {2} of 1 directory and {4} of 1 
symlink on the system were successfully compared with @@PRODUCT_NAME@@-Managed 
files. [&lt;a href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_2_dirs_1_symlinks_2">
+               <source>{0} of {1} files and {2} of 1 directory and {4} of {5} 
symlinks on the system were successfully compared with @@PRODUCT_NAME@@-Managed 
files. [&lt;a href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_2_dirs_2_symlinks_0">
+               <source>{0} of {1} files and {2} of {3} directories on the 
system were successfully compared with @@PRODUCT_NAME@@-Managed files. [&lt;a 
href=&quot;{6}&quot;&gt;View Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_2_dirs_2_symlinks_1">
+               <source>{0} of {1} files and {2} of {3} directories and {4} of 
1 symlink on the system were successfully compared with 
@@PRODUCT_NAME@@-Managed files. [&lt;a href=&quot;{6}&quot;&gt;View 
Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.diff.files_2_dirs_2_symlinks_2">
+               <source>{0} of {1} files and {2} of {3} directories and {4} of 
{5} symlinks on the system were successfully compared with 
@@PRODUCT_NAME@@-Managed files. [&lt;a href=&quot;{6}&quot;&gt;View 
Details&lt;/a&gt;]</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.differing.files_0">
+               <source>No existing files in the existing system differed from 
the @@PRODUCT_NAME@@-Managed files.</source>
         </trans-unit>
-                       
-            <trans-unit id="sdc.config.differing.files_1">
-             <source>1 of 1 file on the system differed from the 
@@PRODUCT_NAME@@-Managed files</source>
-            </trans-unit>
-            <trans-unit id="sdc.config.differing.files_2">
-             <source>{0} of {1} files on the system differed from the 
@@PRODUCT_NAME@@-Managed files.</source>
-            </trans-unit>           
-       </group>        
+
+       <trans-unit id="sdc.config.differing.files_1">
+               <source>1 of 1 file on the system differed from the 
@@PRODUCT_NAME@@-Managed files</source>
+       </trans-unit>
+
+       <trans-unit id="sdc.config.differing.files_2">
+               <source>{0} of {1} files on the system differed from the 
@@PRODUCT_NAME@@-Managed files.</source>
+       </trans-unit>
+    </group>
 
     <group>
        <context-group name="sdc_actions_time_messages">
-- 
1.6.4

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 e6f9d0c..6095908 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/CreateChannelCommand.java
@@ -47,8 +47,6 @@ public class CreateChannelCommand {
     protected static final String CHANNEL_LABEL_REGEX =
         "^[a-z\\d][a-z\\d\\-\\.\\_]*$";
 
-    // we ignore case with the red hat regex
-    protected static final String REDHAT_REGEX = "^(rhn|red\\s*hat)";
     protected static final String GPG_KEY_REGEX = "^[0-9A-F]{8}$";
     protected static final String GPG_URL_REGEX = "^(https?|file)://.*?$";
     protected static final String GPG_FP_REGEX = "^(\\s*[0-9A-F]{4}\\s*){10}$";
@@ -391,16 +389,6 @@ public class CreateChannelCommand {
                 "edit.channel.invalidchannelname.maxlength",
                 maxLength.toString());
         }
-
-        // the perl code used to ignore case with a /i at the end of
-        // the regex, so we toLowerCase() the channel name to make it
-        // work the same.
-        if (!user.hasRole(RoleFactory.RHN_SUPERUSER) &&
-            Pattern.compile(REDHAT_REGEX).matcher(cname.toLowerCase()).find()) 
{
-            throw new InvalidChannelNameException(cname,
-                InvalidChannelNameException.Reason.RHN_CHANNEL_BAD_PERMISSIONS,
-                "edit.channel.invalidchannelname.redhat", "");
-        }
     }
     
     protected void verifyChannelLabel(String clabel) throws 
InvalidChannelLabelException {
@@ -429,16 +417,6 @@ public class CreateChannelCommand {
                 "edit.channel.invalidchannellabel.minlength",
                 minLength.toString());
         }
-        
-        // the perl code used to ignore case with a /i at the end of
-        // the regex, so we toLowerCase() the channel name to make it
-        // work the same.
-        if (!user.hasRole(RoleFactory.RHN_SUPERUSER) &&
-            
Pattern.compile(REDHAT_REGEX).matcher(clabel.toLowerCase()).find()) {
-            throw new InvalidChannelLabelException(clabel,
-                
InvalidChannelLabelException.Reason.RHN_CHANNEL_BAD_PERMISSIONS,
-                "edit.channel.invalidchannellabel.redhat", "");
-        }
     }
     
     protected void verifyGpgInformation() {
diff --git 
a/java/code/webapp/WEB-INF/pages/configuration/sdc/viewdiffresult.jsp 
b/java/code/webapp/WEB-INF/pages/configuration/sdc/viewdiffresult.jsp
index 8be4aef..4a4f7ed 100644
--- a/java/code/webapp/WEB-INF/pages/configuration/sdc/viewdiffresult.jsp
+++ b/java/code/webapp/WEB-INF/pages/configuration/sdc/viewdiffresult.jsp
@@ -73,9 +73,9 @@
        </tr>
        <tr>
                <th><bean:message key="sdc.config.diff_result.diff"/>:</th>
-                       <td><c:out 
value="${revisionBean.configRevisionActionResult.resultContents}"/>
+                       <td><pre style="word-wrap: break-word; white-space: 
-moz-pre-wrap; white-space: pre-wrap;"><c:out 
value="${revisionBean.configRevisionActionResult.resultContents}"/></pre>
                        </td>
        </tr>   
 </table>
 </p>
-</body>
\ No newline at end of file
+</body>
_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to