java/code
by Justin Sherrill
java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 386f8e2029d58e5f67ac194b893bcc7215c3fbcf
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Fri Feb 12 17:15:46 2010 -0500
changing new rev number to be one more than latest, not one more than current
diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf b/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf
index b1e2907..7f1272a 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf
@@ -114,7 +114,7 @@
mixins="com.redhat.rhn.common.security.acl.ConfigAclHandler">
<th> <bean:message key="filedetails.details.jspf.revnum"/> </th>
<td>
- <html:text property="revnum" size="4" value="${revision.revision + 1}"/>
+ <html:text property="revnum" size="4" value="${revnum}"/>
</td>
</rhn:require>
</tr>
14 years, 3 months
Changes to 'refs/tags/spacewalk-java-0.8.13-1'
by Justin Sherrill
Tag 'spacewalk-java-0.8.13-1' created by Justin Sherrill <jsherril(a)redhat.com> at 2010-02-12 22:03 +0000
Tagging package [spacewalk-java] version [0.8.13-1] in directory [java/].
Changes since spacewalk-web-0.8.17-1:
Justin Sherrill (2):
510100 - adding the ability to set a config file to a certain revision
Automatic commit of package [spacewalk-java] release [0.8.13-1].
---
java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java | 4 +
java/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java | 3
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml | 6 +
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 6 +
java/code/src/com/redhat/rhn/manager/configuration/ConfigFileBuilder.java | 32 ++++++++++
java/code/src/com/redhat/rhn/manager/configuration/file/ConfigFileData.java | 17 +++++
java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf | 9 ++
java/code/webapp/WEB-INF/struts-config.xml | 1
java/spacewalk-java.spec | 6 +
rel-eng/packages/spacewalk-java | 2
10 files changed, 83 insertions(+), 3 deletions(-)
---
14 years, 3 months
Branch 'SPACEWALK-0.8' - java/spacewalk-java.spec rel-eng/packages
by Justin Sherrill
java/spacewalk-java.spec | 6 +++++-
rel-eng/packages/spacewalk-java | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit a9754a1055e65715b76234cafe4e7cf9ea14867a
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Fri Feb 12 17:03:03 2010 -0500
Automatic commit of package [spacewalk-java] release [0.8.13-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 62a294a..0adc02f 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -12,7 +12,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 0.8.12
+Version: 0.8.13
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -283,6 +283,10 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Fri Feb 12 2010 Justin Sherrill <jsherril(a)redhat.com> 0.8.13-1
+- 510100 - adding the ability to set a config file to a certain revision
+ (jsherril(a)redhat.com)
+
* Wed Feb 10 2010 Michael Mraka <michael.mraka(a)redhat.com> 0.8.12-1
- 558628 - fixing configure-proxy issu script and /cblr rewrites over SSL
- fixed select all and update set would clear the set before redisplaying
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index e58c129..28d1f1c 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-0.8.12-1 java/
+0.8.13-1 java/
14 years, 3 months
Branch 'SPACEWALK-0.8' - java/code
by Justin Sherrill
java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java | 4 +
java/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java | 3
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml | 6 +
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 6 +
java/code/src/com/redhat/rhn/manager/configuration/ConfigFileBuilder.java | 32 ++++++++++
java/code/src/com/redhat/rhn/manager/configuration/file/ConfigFileData.java | 17 +++++
java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf | 9 ++
java/code/webapp/WEB-INF/struts-config.xml | 1
8 files changed, 77 insertions(+), 1 deletion(-)
New commits:
commit 1482a65274ad438b271300c85bbfa5a2f91f3f47
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Fri Feb 12 16:54:49 2010 -0500
510100 - adding the ability to set a config file to a certain revision
diff --git a/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java b/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java
index 84233df..99ed406 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java
@@ -68,6 +68,9 @@ public class ConfigFileForm extends ScrubbingDynaActionForm {
public static final String REV_EDITABLE = "editable";
public static final String REV_DISPLAYABLE = "displayable";
public static final String REV_TOOLARGE = "toolarge";
+ public static final String REV_NUMBER = "revnum";
+
+
public static final String DEFAULT_CONFIG_DELIM_START = "{|";
public static final String DEFAULT_CONFIG_DELIM_END = "|}";
@@ -313,6 +316,7 @@ public class ConfigFileForm extends ScrubbingDynaActionForm {
data.setOwner(getString(REV_UID));
data.setPermissions(getString(REV_PERMS));
data.setSelinuxCtx(getString(REV_SELINUX_CTX));
+ data.setRevNumber(getString(REV_NUMBER));
data.setType(extractFileType());
return data;
}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java b/java/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java
index bab6b56..d51808b 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java
@@ -54,6 +54,7 @@ public class FileDetailsAction extends RhnAction {
public static final String LAST_USER = "lastUser";
public static final String LAST_USER_ID = "lastUserId";
public static final String TOOLARGE = "toolarge";
+ public static final String REV_NUM = "revnum";
public static final String VALIDATION_XSD =
"/com/redhat/rhn/frontend/action/configuration/validation/configFileForm.xsd";
@@ -144,6 +145,8 @@ public class FileDetailsAction extends RhnAction {
StringUtil.categorizeTime(cr.getConfigContent().
getModified().getTime(),
StringUtil.WEEKS_UNITS));
+ request.setAttribute(REV_NUM,
+ cr.getConfigFile().getLatestConfigRevision().getRevision() + 1);
User lastUser = cr.getChangedBy();
if (lastUser != null) {
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 5cb08b1..0c618f1 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
@@ -8454,6 +8454,12 @@ Follow this url to see the full list of inactive systems:
<trans-unit id="channeltarget.success">
<source>Subscribed {0} system(s) to {1}.</source>
</trans-unit>
+ <trans-unit id="error.config.revnum.too-old">
+ <source>The specified revision number must be greater than the current revision number.</source>
+ </trans-unit>
+ <trans-unit id="error.config.revnum.invalid">
+ <source>Please specify a valid revision number.</source>
+ </trans-unit>
<trans-unit id="kickstart.cobbler.distro.syncfail">
<source>
The following is a list of errors gathered while Spacewalk attempts to
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index efb6ddf..72d6dab 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -21559,7 +21559,11 @@ given channel.</source>
</trans-unit>
<trans-unit id="channel.edit.jsp.sync">
<source>Sync Repo</source>
- </trans-unit>
+ </trans-unit>
+ <trans-unit id="filedetails.details.jspf.revnum">
+ <source>Next revision number:</source>
+ </trans-unit>
+
</body>
</file>
</xliff>
diff --git a/java/code/src/com/redhat/rhn/manager/configuration/ConfigFileBuilder.java b/java/code/src/com/redhat/rhn/manager/configuration/ConfigFileBuilder.java
index 638abef..507bd85 100644
--- a/java/code/src/com/redhat/rhn/manager/configuration/ConfigFileBuilder.java
+++ b/java/code/src/com/redhat/rhn/manager/configuration/ConfigFileBuilder.java
@@ -26,6 +26,8 @@ import com.redhat.rhn.domain.config.ConfigurationFactory;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.manager.configuration.file.ConfigFileData;
+import org.apache.commons.lang.StringUtils;
+
import java.io.IOException;
@@ -108,6 +110,15 @@ public class ConfigFileBuilder {
return makeNewRevision(user, cff, cf, true);
}
+
+ private ConfigRevision makeNewRevision(User user, ConfigFileData form,
+ ConfigFile cf, boolean onCreate, Long revNum) {
+ ConfigRevision rev = makeNewRevision(user, form, cf, onCreate);
+ rev.setRevision(revNum);
+ ConfigurationFactory.saveNewConfigRevision(rev);
+ return rev;
+ }
+
/**
* Creates a new New config revision of a config file using the passed in data.
* @param user the logged in user
@@ -141,6 +152,10 @@ public class ConfigFileBuilder {
revision.setConfigFile(cf);
revision.setDelimStart(form.getMacroStart());
revision.setDelimEnd(form.getMacroEnd());
+ if (!StringUtils.isEmpty(form.getRevNumber())) {
+ revision.setRevision(Long.parseLong(form.getRevNumber()));
+ }
+
// Committing the revision commits the file for us (which commits the
// Channel, so everybody's pointers get updated...)
@@ -175,6 +190,23 @@ public class ConfigFileBuilder {
throw new ValidatorException(result);
}
else {
+ try {
+ Long l = Long.parseLong(form.getRevNumber());
+ if (l.longValue() <= file.getLatestConfigRevision().getRevision()) {
+ result = new ValidatorResult();
+ result.addError(new ValidatorError("error.config.revnum.too-old",
+ form.getPath()));
+ throw new ValidatorException(result);
+ }
+ }
+ catch (NumberFormatException nfe) {
+ result = new ValidatorResult();
+ result.addError(new ValidatorError("error.config.revnum.invalid",
+ form.getPath()));
+ throw new ValidatorException(result);
+ }
+
+
form.validate(false);
}
diff --git a/java/code/src/com/redhat/rhn/manager/configuration/file/ConfigFileData.java b/java/code/src/com/redhat/rhn/manager/configuration/file/ConfigFileData.java
index 77e9a72..1c5e28f 100644
--- a/java/code/src/com/redhat/rhn/manager/configuration/file/ConfigFileData.java
+++ b/java/code/src/com/redhat/rhn/manager/configuration/file/ConfigFileData.java
@@ -52,6 +52,7 @@ public abstract class ConfigFileData {
private String selinuxCtx;
private String macroStart;
private String macroEnd;
+ private String revNumber;
private ConfigFileType type;
@@ -400,4 +401,20 @@ public abstract class ConfigFileData {
append("Size:", getContentSize());
return builder.toString();
}
+
+
+ /**
+ * @return Returns the revNumber.
+ */
+ public String getRevNumber() {
+ return revNumber;
+ }
+
+
+ /**
+ * @param revNumberIn The revNumber to set.
+ */
+ public void setRevNumber(String revNumberIn) {
+ this.revNumber = revNumberIn;
+ }
}
diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf b/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf
index 94466b7..b1e2907 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf
@@ -109,4 +109,13 @@
</c:choose>
</td>
</tr>
+<tr>
+<rhn:require acl="config_channel_editable(${channel.id})"
+ mixins="com.redhat.rhn.common.security.acl.ConfigAclHandler">
+ <th> <bean:message key="filedetails.details.jspf.revnum"/> </th>
+ <td>
+ <html:text property="revnum" size="4" value="${revision.revision + 1}"/>
+ </td>
+ </rhn:require>
+</tr>
</table>
diff --git a/java/code/webapp/WEB-INF/struts-config.xml b/java/code/webapp/WEB-INF/struts-config.xml
index c629f83..c522cd1 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -899,6 +899,7 @@
<form-property name="cffUpload" type="org.apache.struts.upload.FormFile" />
<form-property name="contents" type="java.lang.String"/>
<form-property name="filetype" type="java.lang.String" />
+ <form-property name="revnum" type="java.lang.String" />
<form-property name="binary" type="java.lang.Boolean" />
<form-property name="submitted" type="java.lang.Boolean"/>
</form-bean>
14 years, 3 months
java/code
by Justin Sherrill
java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java | 4 +
java/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java | 3
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml | 6 +
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 6 +
java/code/src/com/redhat/rhn/manager/configuration/ConfigFileBuilder.java | 32 ++++++++++
java/code/src/com/redhat/rhn/manager/configuration/file/ConfigFileData.java | 17 +++++
java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf | 9 ++
java/code/webapp/WEB-INF/struts-config.xml | 1
8 files changed, 77 insertions(+), 1 deletion(-)
New commits:
commit 663f0cb9c44dfaa49b115537d8989af9a4b0c1d1
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Fri Feb 12 16:54:49 2010 -0500
510100 - adding the ability to set a config file to a certain revision
diff --git a/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java b/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java
index 84233df..99ed406 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java
@@ -68,6 +68,9 @@ public class ConfigFileForm extends ScrubbingDynaActionForm {
public static final String REV_EDITABLE = "editable";
public static final String REV_DISPLAYABLE = "displayable";
public static final String REV_TOOLARGE = "toolarge";
+ public static final String REV_NUMBER = "revnum";
+
+
public static final String DEFAULT_CONFIG_DELIM_START = "{|";
public static final String DEFAULT_CONFIG_DELIM_END = "|}";
@@ -313,6 +316,7 @@ public class ConfigFileForm extends ScrubbingDynaActionForm {
data.setOwner(getString(REV_UID));
data.setPermissions(getString(REV_PERMS));
data.setSelinuxCtx(getString(REV_SELINUX_CTX));
+ data.setRevNumber(getString(REV_NUMBER));
data.setType(extractFileType());
return data;
}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java b/java/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java
index bab6b56..d51808b 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/configuration/files/FileDetailsAction.java
@@ -54,6 +54,7 @@ public class FileDetailsAction extends RhnAction {
public static final String LAST_USER = "lastUser";
public static final String LAST_USER_ID = "lastUserId";
public static final String TOOLARGE = "toolarge";
+ public static final String REV_NUM = "revnum";
public static final String VALIDATION_XSD =
"/com/redhat/rhn/frontend/action/configuration/validation/configFileForm.xsd";
@@ -144,6 +145,8 @@ public class FileDetailsAction extends RhnAction {
StringUtil.categorizeTime(cr.getConfigContent().
getModified().getTime(),
StringUtil.WEEKS_UNITS));
+ request.setAttribute(REV_NUM,
+ cr.getConfigFile().getLatestConfigRevision().getRevision() + 1);
User lastUser = cr.getChangedBy();
if (lastUser != null) {
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 5cb08b1..0c618f1 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
@@ -8454,6 +8454,12 @@ Follow this url to see the full list of inactive systems:
<trans-unit id="channeltarget.success">
<source>Subscribed {0} system(s) to {1}.</source>
</trans-unit>
+ <trans-unit id="error.config.revnum.too-old">
+ <source>The specified revision number must be greater than the current revision number.</source>
+ </trans-unit>
+ <trans-unit id="error.config.revnum.invalid">
+ <source>Please specify a valid revision number.</source>
+ </trans-unit>
<trans-unit id="kickstart.cobbler.distro.syncfail">
<source>
The following is a list of errors gathered while Spacewalk attempts to
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index efb6ddf..72d6dab 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -21559,7 +21559,11 @@ given channel.</source>
</trans-unit>
<trans-unit id="channel.edit.jsp.sync">
<source>Sync Repo</source>
- </trans-unit>
+ </trans-unit>
+ <trans-unit id="filedetails.details.jspf.revnum">
+ <source>Next revision number:</source>
+ </trans-unit>
+
</body>
</file>
</xliff>
diff --git a/java/code/src/com/redhat/rhn/manager/configuration/ConfigFileBuilder.java b/java/code/src/com/redhat/rhn/manager/configuration/ConfigFileBuilder.java
index 638abef..507bd85 100644
--- a/java/code/src/com/redhat/rhn/manager/configuration/ConfigFileBuilder.java
+++ b/java/code/src/com/redhat/rhn/manager/configuration/ConfigFileBuilder.java
@@ -26,6 +26,8 @@ import com.redhat.rhn.domain.config.ConfigurationFactory;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.manager.configuration.file.ConfigFileData;
+import org.apache.commons.lang.StringUtils;
+
import java.io.IOException;
@@ -108,6 +110,15 @@ public class ConfigFileBuilder {
return makeNewRevision(user, cff, cf, true);
}
+
+ private ConfigRevision makeNewRevision(User user, ConfigFileData form,
+ ConfigFile cf, boolean onCreate, Long revNum) {
+ ConfigRevision rev = makeNewRevision(user, form, cf, onCreate);
+ rev.setRevision(revNum);
+ ConfigurationFactory.saveNewConfigRevision(rev);
+ return rev;
+ }
+
/**
* Creates a new New config revision of a config file using the passed in data.
* @param user the logged in user
@@ -141,6 +152,10 @@ public class ConfigFileBuilder {
revision.setConfigFile(cf);
revision.setDelimStart(form.getMacroStart());
revision.setDelimEnd(form.getMacroEnd());
+ if (!StringUtils.isEmpty(form.getRevNumber())) {
+ revision.setRevision(Long.parseLong(form.getRevNumber()));
+ }
+
// Committing the revision commits the file for us (which commits the
// Channel, so everybody's pointers get updated...)
@@ -175,6 +190,23 @@ public class ConfigFileBuilder {
throw new ValidatorException(result);
}
else {
+ try {
+ Long l = Long.parseLong(form.getRevNumber());
+ if (l.longValue() <= file.getLatestConfigRevision().getRevision()) {
+ result = new ValidatorResult();
+ result.addError(new ValidatorError("error.config.revnum.too-old",
+ form.getPath()));
+ throw new ValidatorException(result);
+ }
+ }
+ catch (NumberFormatException nfe) {
+ result = new ValidatorResult();
+ result.addError(new ValidatorError("error.config.revnum.invalid",
+ form.getPath()));
+ throw new ValidatorException(result);
+ }
+
+
form.validate(false);
}
diff --git a/java/code/src/com/redhat/rhn/manager/configuration/file/ConfigFileData.java b/java/code/src/com/redhat/rhn/manager/configuration/file/ConfigFileData.java
index 77e9a72..1c5e28f 100644
--- a/java/code/src/com/redhat/rhn/manager/configuration/file/ConfigFileData.java
+++ b/java/code/src/com/redhat/rhn/manager/configuration/file/ConfigFileData.java
@@ -52,6 +52,7 @@ public abstract class ConfigFileData {
private String selinuxCtx;
private String macroStart;
private String macroEnd;
+ private String revNumber;
private ConfigFileType type;
@@ -400,4 +401,20 @@ public abstract class ConfigFileData {
append("Size:", getContentSize());
return builder.toString();
}
+
+
+ /**
+ * @return Returns the revNumber.
+ */
+ public String getRevNumber() {
+ return revNumber;
+ }
+
+
+ /**
+ * @param revNumberIn The revNumber to set.
+ */
+ public void setRevNumber(String revNumberIn) {
+ this.revNumber = revNumberIn;
+ }
}
diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf b/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf
index 94466b7..b1e2907 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/details.jspf
@@ -109,4 +109,13 @@
</c:choose>
</td>
</tr>
+<tr>
+<rhn:require acl="config_channel_editable(${channel.id})"
+ mixins="com.redhat.rhn.common.security.acl.ConfigAclHandler">
+ <th> <bean:message key="filedetails.details.jspf.revnum"/> </th>
+ <td>
+ <html:text property="revnum" size="4" value="${revision.revision + 1}"/>
+ </td>
+ </rhn:require>
+</tr>
</table>
diff --git a/java/code/webapp/WEB-INF/struts-config.xml b/java/code/webapp/WEB-INF/struts-config.xml
index c629f83..c522cd1 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -899,6 +899,7 @@
<form-property name="cffUpload" type="org.apache.struts.upload.FormFile" />
<form-property name="contents" type="java.lang.String"/>
<form-property name="filetype" type="java.lang.String" />
+ <form-property name="revnum" type="java.lang.String" />
<form-property name="binary" type="java.lang.Boolean" />
<form-property name="submitted" type="java.lang.Boolean"/>
</form-bean>
14 years, 3 months
Changes to 'refs/tags/rhnlib-2.5.22-1'
by Miroslav Suchý
Tag 'rhnlib-2.5.22-1' created by Miroslav Suchý <msuchy(a)redhat.com> at 2010-02-12 14:11 +0000
Tagging package [rhnlib] version [2.5.22-1] in directory [client/rhel/rhnlib/].
Changes since spacewalk-branding-0.9.2-1:
Justin Sherrill (1):
making timezone still null errors a bit quieter. Maybe once we really add all the timezones we can really do a warning
Miroslav Suchý (13):
564299 - Handle http 302 redirect request for satellite-sync
move setting _host, _handler and _type to function so we can reuse this code
global variable are evil, make send_handle class attribute
remove commented code
make condition more readable
we should follow 301 redirects too
no need to explicitly say continue on the end of the loop
type can be None
make rpc_version class attribute and initiate it only once
make split_host IPv6 compliant
convert comments to docstring
change old comment, which is not 100% true
Automatic commit of package [rhnlib] release [2.5.22-1].
---
client/rhel/rhnlib/rhn/rpclib.py | 161 +++++-----
client/rhel/rhnlib/rhnlib.spec | 6
java/code/src/com/redhat/rhn/frontend/servlets/LocalizedEnvironmentFilter.java | 2
rel-eng/packages/rhnlib | 2
4 files changed, 96 insertions(+), 75 deletions(-)
---
14 years, 3 months
client/rhel rel-eng/packages
by Miroslav Suchý
client/rhel/rhnlib/rhnlib.spec | 6 +++++-
rel-eng/packages/rhnlib | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit 1c49377f8478cca5882852affe44a549dd65d973
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 15:11:36 2010 +0100
Automatic commit of package [rhnlib] release [2.5.22-1].
diff --git a/client/rhel/rhnlib/rhnlib.spec b/client/rhel/rhnlib/rhnlib.spec
index ef90c4d..8d3c98a 100644
--- a/client/rhel/rhnlib/rhnlib.spec
+++ b/client/rhel/rhnlib/rhnlib.spec
@@ -4,7 +4,7 @@ Summary: Python libraries for the RHN project
Name: rhnlib
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 2.5.21
+Version: 2.5.22
Release: 1%{?dist}
Group: Development/Libraries
@@ -54,6 +54,10 @@ rm -rf $RPM_BUILD_ROOT
%{python_sitelib}/*
%changelog
+* Fri Feb 12 2010 Miroslav Suchý <msuchy(a)redhat.com> 2.5.22-1
+- 564299 - handle http 302 redirect request for satellite-sync
+- rpclib.py cleanup
+
* Thu Feb 04 2010 Michael Mraka <michael.mraka(a)redhat.com> 2.5.21-1
- updated copyrights
diff --git a/rel-eng/packages/rhnlib b/rel-eng/packages/rhnlib
index 4891ddf..1c9b231 100644
--- a/rel-eng/packages/rhnlib
+++ b/rel-eng/packages/rhnlib
@@ -1 +1 @@
-2.5.21-1 client/rhel/rhnlib/
+2.5.22-1 client/rhel/rhnlib/
14 years, 3 months
12 commits - client/rhel
by Miroslav Suchý
client/rhel/rhnlib/rhn/rpclib.py | 161 +++++++++++++++++++++------------------
1 file changed, 89 insertions(+), 72 deletions(-)
New commits:
commit 5ed80674dbc037c4659faba58b168b5c7bdb0484
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 15:06:54 2010 +0100
change old comment, which is not 100% true
we change this class a lot. it is not cut-n-paste any more
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index 1c363d4..57f24a4 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -96,10 +96,7 @@ class MalformedURIError(IOError):
pass
-# This is a cut-and-paste of xmlrpclib.ServerProxy, with the data members made
-# protected instead of private
-# It also adds support for changing the way the request is made (XMLRPC or
-# GET)
+# Originaly taken from xmlrpclib.ServerProxy, now changed most of the code
class Server:
"""uri [,options] -> a logical connection to an XML-RPC server
commit b08164c4191369f63d821dc7598cdfe65931349a
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 14:55:07 2010 +0100
convert comments to docstring
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index 3bc0c70..1c363d4 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -43,10 +43,10 @@ def check_ipv6(n):
except:
return False
-#
-# Function used to split host information in an URL per RFC 2396
-# handle full hostname like user:passwd@host:port
def split_host(hoststring):
+ """ Function used to split host information in an URL per RFC 2396
+ handle full hostname like user:passwd@host:port
+ """
l = hoststring.split('@', 1)
host = None
port = None
@@ -315,7 +315,8 @@ class Server:
self._handler = "/RPC2"
def _request(self, methodname, params):
- # call a method on the remote server
+ """ Call a method on the remote server
+ we can handle redirections. """
# the loop is used to handle redirections
redirect_response = 0
retry = 0
@@ -612,8 +613,9 @@ def getHeaderValues(headers, name):
headers.getallmatchingheaders(name))
class _Method:
- # some magic to bind an XML-RPC method to an RPC server.
- # supports "nested" methods (e.g. examples.getStateName)
+ """ some magic to bind an XML-RPC method to an RPC server.
+ supports "nested" methods (e.g. examples.getStateName)
+ """
def __init__(self, send, name):
self._send = send
self._name = name
@@ -661,7 +663,7 @@ class SlicingMethod(_Method):
def reportError(headers):
- # Reports the error from the headers
+ """ Reports the error from the headers. """
errcode = 0
errmsg = ""
s = "X-RHN-Fault-Code"
commit a1f3148904c7d4aae9c484bfb3a6d9f992af1445
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 14:44:23 2010 +0100
make split_host IPv6 compliant
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index cc2eaf8..3bc0c70 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -19,6 +19,8 @@ __version__ = "$Revision$"
import transports
import urllib
+import socket
+import re
from types import ListType, TupleType
@@ -33,12 +35,17 @@ from transports import File
MAX_REDIRECTIONS = 5
+def check_ipv6(n):
+ """ Returns true if n is IPv6 address, false otherwise. """
+ try:
+ socket.inet_pton(socket.AF_INET6, n)
+ return True
+ except:
+ return False
+
#
# Function used to split host information in an URL per RFC 2396
# handle full hostname like user:passwd@host:port
-#
-# TODO: check IPv6 numerical IPs it may break
-#
def split_host(hoststring):
l = hoststring.split('@', 1)
host = None
@@ -57,10 +64,19 @@ def split_host(hoststring):
hostport = l[0]
# Now parse hostport
- arr = hostport.split(':', 1)
- host = arr[0]
- if len(arr) == 2:
- port = arr[1]
+ if hostport[0] == '[':
+ # IPv6 with port
+ host, port = re.split('(?<=\]):', ip_port, 1)
+ host = host.lstrip('[').rstrip(']')
+ elif check_ipv6(hostport):
+ # just IPv6
+ host = hostport
+ else:
+ # IPv4
+ arr = hostport.split(':', 1)
+ host = arr[0]
+ if len(arr) == 2:
+ port = arr[1]
return (host, port, user, passwd)
commit 6521bc6b425ea7d8766b1c07f5a94348b4dafa1e
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 14:02:15 2010 +0100
make rpc_version class attribute and initiate it only once
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index 119df0b..cc2eaf8 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -147,6 +147,11 @@ class Server:
self._username = username
self._password = password
+ if len(__version__.split()) > 1:
+ self.rpc_version = __version__.split()[1]
+ else:
+ self.rpc_version = __version__
+
self._reset_host_handler_and_type()
if transport is None:
@@ -299,10 +304,6 @@ class Server:
redirect_response = 0
retry = 0
- rpc_version = __version__
- if len(__version__.split()) > 1:
- rpc_version = __version__.split()[1]
-
self._reset_host_handler_and_type()
while 1:
@@ -317,7 +318,7 @@ class Server:
self._transport.add_header("X-Info",
'RPC Processor (C) Red Hat, Inc (version %s)' %
- rpc_version)
+ self.rpc_version)
# identify the capability set of this client to the server
self._transport.set_header("X-Client-Version", 1)
commit 17ae079905aef31671327ab281e4b549df9c24df
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 14:50:29 2010 +0100
type can be None
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index 7fac7ab..119df0b 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -283,7 +283,10 @@ class Server:
# need at least 3 chars for it to maybe be ok...
if len(uri) < 3 or uri[0:2] != "//":
raise MalformedURIError
- self._type = type.lower()
+ if type != None:
+ self._type = type.lower()
+ else:
+ self._type = type
if self._type not in ("http", "https"):
raise IOError, "unsupported XML-RPC protocol"
self._host, self._handler = urllib.splithost(uri)
commit ec7a0c8ebf670e03ea1766cd49e2b48309513a35
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 13:32:51 2010 +0100
no need to explicitly say continue on the end of the loop
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index 84e01a6..7fac7ab 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -397,7 +397,6 @@ class Server:
for certfile in self._trusted_cert_files:
self._transport.add_trusted_cert(certfile)
# Then restart the loop to try the new entry point.
- continue
if isinstance(response, transports.File):
# Just return the file
commit a076e5dcc9886be01575b862a46138b72ad92acc
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 13:32:08 2010 +0100
we should follow 301 redirects too
and since this part code is only executed for redirects, that condition is always true
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index 725b7e4..84e01a6 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -382,29 +382,22 @@ class Server:
if not self._handler:
self._handler = "/RPC2"
- if save_response == 302:
- redirect_response = 1
-
- #
- # Create a new transport for the redirected service and
- # set up the parameters on the new transport
- #
- del self._transport
- self._transport = self.default_transport(typ, self._proxy,
- self._username, self._password)
- self.set_progress_callback(self._progressCallback)
- self.set_refresh_callback(self._refreshCallback)
- self.set_buffer_size(self._bufferSize)
- self.setlang(self._lang)
-
- if self._trusted_cert_files != [] and \
- hasattr(self._transport, "add_trusted_cert"):
- for certfile in self._trusted_cert_files:
- self._transport.add_trusted_cert(certfile)
- #
- # Then restart the loop to try the new entry point.
- #
- continue
+ # Create a new transport for the redirected service and
+ # set up the parameters on the new transport
+ del self._transport
+ self._transport = self.default_transport(typ, self._proxy,
+ self._username, self._password)
+ self.set_progress_callback(self._progressCallback)
+ self.set_refresh_callback(self._refreshCallback)
+ self.set_buffer_size(self._bufferSize)
+ self.setlang(self._lang)
+
+ if self._trusted_cert_files != [] and \
+ hasattr(self._transport, "add_trusted_cert"):
+ for certfile in self._trusted_cert_files:
+ self._transport.add_trusted_cert(certfile)
+ # Then restart the loop to try the new entry point.
+ continue
if isinstance(response, transports.File):
# Just return the file
commit a4d77fc5f361c052fd3a811e730c96af9f3a7683
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 13:28:18 2010 +0100
make condition more readable
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index b77eada..725b7e4 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -346,14 +346,14 @@ class Server:
if save_response == 200:
# exit redirects loop and return response
break
- elif save_response in (301, 302):
- self._redirected = self._transport.redirected()
- self.use_handler_path = 0
- redirect_response = 1
- else:
+ elif save_response not in (301, 302):
# Retry pkg fetch
self.use_handler_path = 1
continue
+ # rest of loop is run only if we are redirected (301, 302)
+ self._redirected = self._transport.redirected()
+ self.use_handler_path = 0
+ redirect_response = 1
if not self._allow_redirect:
raise InvalidRedirectionError("Redirects not allowed")
commit 7376caf0294ca6cefbb1a9bcd1825fdee1cd3cf9
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 13:24:22 2010 +0100
remove commented code
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index a972675..b77eada 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -344,9 +344,6 @@ class Server:
self._redirected = None
retry += 1
if save_response == 200:
- # reset _host and _handler for next request
- #type, uri = urllib.splittype(self._uri)
- #self._host, self._handler = urllib.splithost(uri)
# exit redirects loop and return response
break
elif save_response in (301, 302):
commit 4f6f99565435a105a9ab5893aa65fd589091328b
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 12:44:59 2010 +0100
global variable are evil, make send_handle class attribute
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index fd7745a..a972675 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -33,9 +33,6 @@ from transports import File
MAX_REDIRECTIONS = 5
-# save the original handler in case of redirect
-send_handler = None
-
#
# Function used to split host information in an URL per RFC 2396
# handle full hostname like user:passwd@host:port
@@ -329,8 +326,8 @@ class Server:
if redirect_response:
self._transport.add_header('X-RHN-Redirect', '0')
- if send_handler:
- self._transport.add_header('X-RHN-Path', send_handler)
+ if self.send_handler:
+ self._transport.add_header('X-RHN-Path', self.send_handler)
request = self._req_body(params, methodname)
@@ -512,10 +509,10 @@ class GETServer(Server):
self._orig_handler = self._handler
# Download resumption
self.set_range(offset=None, amount=None)
+ # referer, which redirect us to new handler
+ self.send_handler=None
def _req_body(self, params, methodname):
- global send_handler
-
if not params or len(params) < 1:
raise Exception("Required parameter channel not found")
# Strip the multiple / from the handler
@@ -525,7 +522,7 @@ class GETServer(Server):
self._handler = '/' + '/'.join(hndl)
#save the constructed handler in case of redirect
- send_handler = self._handler
+ self.send_handler = self._handler
# Add headers
#override the handler to replace /XMLRPC with pkg path
commit 541bdc0a027c775c5f985514b9f4c020fe814926
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 12:08:42 2010 +0100
move setting _host, _handler and _type to function so we can reuse this code
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index 7880363..fd7745a 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -150,21 +150,7 @@ class Server:
self._username = username
self._password = password
- # get the url
- type, uri = urllib.splittype(uri)
- if type is None:
- raise MalformedURIError, "missing protocol in uri"
- # with a real uri passed in, uri will now contain "//hostname..." so we
- # need at least 3 chars for it to maybe be ok...
- if len(uri) < 3 or uri[0:2] != "//":
- raise MalformedURIError
- type = type.lower()
- self._type = type
- if type not in ("http", "https"):
- raise IOError, "unsupported XML-RPC protocol"
- self._host, self._handler = urllib.splithost(uri)
- if not self._handler:
- self._handler = "/RPC2"
+ self._reset_host_handler_and_type()
if transport is None:
self._allow_redirect = 1
@@ -287,6 +273,26 @@ class Server:
return headers['Accept-Ranges']
return None
+ def _reset_host_handler_and_type(self):
+ """ Reset the attributes:
+ self._host, self._handler, self._type
+ according the value of self._uri.
+ """
+ # get the url
+ type, uri = urllib.splittype(self._uri)
+ if type is None:
+ raise MalformedURIError, "missing protocol in uri"
+ # with a real uri passed in, uri will now contain "//hostname..." so we
+ # need at least 3 chars for it to maybe be ok...
+ if len(uri) < 3 or uri[0:2] != "//":
+ raise MalformedURIError
+ self._type = type.lower()
+ if self._type not in ("http", "https"):
+ raise IOError, "unsupported XML-RPC protocol"
+ self._host, self._handler = urllib.splithost(uri)
+ if not self._handler:
+ self._handler = "/RPC2"
+
def _request(self, methodname, params):
# call a method on the remote server
# the loop is used to handle redirections
@@ -297,6 +303,8 @@ class Server:
if len(__version__.split()) > 1:
rpc_version = __version__.split()[1]
+ self._reset_host_handler_and_type()
+
while 1:
if retry >= MAX_REDIRECTIONS:
raise InvalidRedirectionError(
@@ -340,8 +348,8 @@ class Server:
retry += 1
if save_response == 200:
# reset _host and _handler for next request
- type, uri = urllib.splittype(self._uri)
- self._host, self._handler = urllib.splithost(uri)
+ #type, uri = urllib.splittype(self._uri)
+ #self._host, self._handler = urllib.splithost(uri)
# exit redirects loop and return response
break
elif save_response in (301, 302):
commit 06cc87b6f9249cfff26277001763338e3a4896ce
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Feb 12 11:45:21 2010 +0100
564299 - Handle http 302 redirect request for satellite-sync
diff --git a/client/rhel/rhnlib/rhn/rpclib.py b/client/rhel/rhnlib/rhn/rpclib.py
index e62fa03..7880363 100644
--- a/client/rhel/rhnlib/rhn/rpclib.py
+++ b/client/rhel/rhnlib/rhn/rpclib.py
@@ -339,6 +339,10 @@ class Server:
self._redirected = None
retry += 1
if save_response == 200:
+ # reset _host and _handler for next request
+ type, uri = urllib.splittype(self._uri)
+ self._host, self._handler = urllib.splithost(uri)
+ # exit redirects loop and return response
break
elif save_response in (301, 302):
self._redirected = self._transport.redirected()
14 years, 3 months
java/code
by Justin Sherrill
java/code/src/com/redhat/rhn/frontend/servlets/LocalizedEnvironmentFilter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit e741830fc233b790690f5ded01bf47fb10192305
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Feb 11 14:55:59 2010 -0500
making timezone still null errors a bit quieter. Maybe once we really add all the timezones we can really do a warning
diff --git a/java/code/src/com/redhat/rhn/frontend/servlets/LocalizedEnvironmentFilter.java b/java/code/src/com/redhat/rhn/frontend/servlets/LocalizedEnvironmentFilter.java
index 6bc881b..40714c3 100644
--- a/java/code/src/com/redhat/rhn/frontend/servlets/LocalizedEnvironmentFilter.java
+++ b/java/code/src/com/redhat/rhn/frontend/servlets/LocalizedEnvironmentFilter.java
@@ -99,7 +99,7 @@ public class LocalizedEnvironmentFilter implements Filter {
tz = new RhnTimeZone();
tz.setOlsonName(olsonName);
- LOG.warn("timezone still null");
+ LOG.debug("timezone still null");
}
}
ctx.setTimezone(tz.getTimeZone());
14 years, 3 months
Changes to 'refs/tags/spacewalk-branding-0.9.2-1'
by Justin Sherrill
Tag 'spacewalk-branding-0.9.2-1' created by Justin Sherrill <jsherril(a)redhat.com> at 2010-02-11 19:28 +0000
Tagging package [spacewalk-branding] version [0.9.2-1] in directory [branding/].
Changes since spacewalk-branding-0.9.1-1:
Justin Sherrill (2):
forgot one mention of tomcat5 in the branding spec file
Automatic commit of package [spacewalk-branding] release [0.9.2-1].
---
branding/spacewalk-branding.spec | 8 ++++++--
rel-eng/packages/spacewalk-branding | 2 +-
2 files changed, 7 insertions(+), 3 deletions(-)
---
14 years, 3 months