branding/img
by Jan Pazdziora
branding/img/nav/navPrimeRight3.png |binary
1 file changed
New commits:
commit 6b52b7408306896c00a186345e431b45ac0e7b7c
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Sep 2 14:45:43 2011 +0200
558972 - making the navigational bar nice on 2000+ px wide screens.
diff --git a/branding/img/nav/navPrimeRight3.png b/branding/img/nav/navPrimeRight3.png
index 862dbd2..6690e68 100644
Binary files a/branding/img/nav/navPrimeRight3.png and b/branding/img/nav/navPrimeRight3.png differ
12 years, 8 months
java/code
by Milan Zazrivec
java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java | 8 ++---
java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java | 4 +-
java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java | 14 +++++-----
3 files changed, 13 insertions(+), 13 deletions(-)
New commits:
commit faeb8408f224b73c3bc2ca463dac4364b02eb717
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Fri Sep 2 13:04:45 2011 +0200
Checkstyle fixes
diff --git a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
index 6c536a7..d6d929f 100644
--- a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
@@ -411,14 +411,14 @@ public class ConfigurationFactory extends HibernateFactory {
/**
* Finds a ConfigRevision for a given ConfigFile and given revision id
- * @param ConfigFile The ConfigFile to look for.
- * @param rev_id The ConfigFile revision to look for.
+ * @param cf The ConfigFile to look for.
+ * @param revId The ConfigFile revision to look for.
* @return ConfigRevision The sought for ConfigRevision.
*/
- public static ConfigRevision lookupConfigRevisionByRevId(ConfigFile cf, Long rev_id) {
+ public static ConfigRevision lookupConfigRevisionByRevId(ConfigFile cf, Long revId) {
Session session = HibernateFactory.getSession();
Query q = session.getNamedQuery("ConfigRevision.findByRevisionAndConfigFile");
- q.setLong("rev", rev_id.longValue());
+ q.setLong("rev", revId.longValue());
q.setEntity("cf", cf);
return (ConfigRevision) q.uniqueResult();
}
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
index 695fcfb..d4ddae9 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
@@ -114,9 +114,9 @@ public class ConfigChannelHandler extends BaseHandler {
ConfigurationManager cm = ConfigurationManager.getInstance();
ConfigFile cf = cm.lookupConfigFile(loggedInUser, cc.getId(), filePath);
- for (Integer rev_id : revisions) {
+ for (Integer revId : revisions) {
ConfigRevision cr = cm.lookupConfigRevisionByRevId(loggedInUser, cf,
- rev_id.longValue());
+ revId.longValue());
cm.deleteConfigRevision(loggedInUser, cr);
}
diff --git a/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java b/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
index 8fcf22a..ad5e1e4 100644
--- a/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
+++ b/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
@@ -1887,23 +1887,23 @@ public class ConfigurationManager extends BaseManager {
* For a given configuration file, looks up a config revision id
* @param user The user requesting to lookup a config revision.
* @param cf The ConfigFile that the revision applies to
- * @param rev_id The ConfigFile revision id.
+ * @param revId The ConfigFile revision id.
* @return The sought for config revision.
*/
public ConfigRevision lookupConfigRevisionByRevId(User user, ConfigFile cf,
- Long rev_id) {
- ConfigRevision cr = ConfigurationFactory.lookupConfigRevisionByRevId(cf, rev_id);
+ Long revId) {
+ ConfigRevision cr = ConfigurationFactory.lookupConfigRevisionByRevId(cf, revId);
if (cr == null) {
- throw new LookupException("Could not find config revision with revision id="
- + rev_id);
+ throw new LookupException("Could not find config revision with revision id=" +
+ revId);
}
if (!accessToRevision(user.getId(), cr.getId())) {
LocalizationService ls = LocalizationService.getInstance();
LookupException e =
- new LookupException("Could not find config revision with revision id="
- + rev_id);
+ new LookupException("Could not find config revision with revision id=" +
+ revId);
e.setLocalizedTitle(ls.getMessage("lookup.configrev.title"));
e.setLocalizedReason1(ls.getMessage("lookup.configrev.reason1"));
e.setLocalizedReason2(ls.getMessage("lookup.configrev.reason2"));
12 years, 8 months
Changes to 'refs/tags/spacewalk-java-1.6.36-1'
by Tomas Lestach
Tag 'spacewalk-java-1.6.36-1' created by Tomas Lestach <tlestach(a)redhat.com> at 2011-09-02 10:03 +0000
Tagging package [spacewalk-java] version [1.6.36-1] in directory [java/].
Changes since spacewalk-java-1.6.35-1:
Tomas Lestach (2):
checkstyle fix
Automatic commit of package [spacewalk-java] release [1.6.36-1].
---
java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java | 1 +
java/spacewalk-java.spec | 5 ++++-
rel-eng/packages/spacewalk-java | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
---
12 years, 8 months
java/spacewalk-java.spec rel-eng/packages
by Tomas Lestach
java/spacewalk-java.spec | 5 ++++-
rel-eng/packages/spacewalk-java | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 332d1191d33bea1d24ddcf6ba5dd3f53636f61d8
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Sep 2 12:03:04 2011 +0200
Automatic commit of package [spacewalk-java] release [1.6.36-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 8a49b25..90a3dfe 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -17,7 +17,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.6.35
+Version: 1.6.36
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -547,6 +547,9 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Fri Sep 02 2011 Tomas Lestach <tlestach(a)redhat.com> 1.6.36-1
+- checkstyle fix (tlestach(a)redhat.com)
+
* Fri Sep 02 2011 Martin Minar <mminar(a)redhat.com> 1.6.35-1
- 734799 - New API: configchannel.getFileRevision (mzazrivec(a)redhat.com)
- 734799 - New API: configchannel.getFileRevisions (mzazrivec(a)redhat.com)
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index 74b0810..5b0caad 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.6.35-1 java/
+1.6.36-1 java/
12 years, 8 months
java/code
by Tomas Lestach
java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java | 1 +
1 file changed, 1 insertion(+)
New commits:
commit fed06122b7ee66ad12987760f18dfdcd2b142ccf
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Sep 2 12:02:38 2011 +0200
checkstyle fix
diff --git a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
index a7122be..6c536a7 100644
--- a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
@@ -39,6 +39,7 @@ import java.io.InputStream;
import java.sql.Types;
import java.util.Date;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
/**
12 years, 8 months
Changes to 'refs/tags/spacewalk-java-1.6.35-1'
by Martin Minar
Tag 'spacewalk-java-1.6.35-1' created by Martin Minar <mminar(a)redhat.com> at 2011-09-02 09:36 +0000
Tagging package [spacewalk-java] version [1.6.35-1] in directory [java/].
Changes since spacewalk-backend-1.6.15-1:
Martin Minar (1):
Automatic commit of package [spacewalk-java] release [1.6.35-1].
---
java/spacewalk-java.spec | 7 ++++++-
rel-eng/packages/spacewalk-java | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
---
12 years, 8 months
java/spacewalk-java.spec rel-eng/packages
by Martin Minar
java/spacewalk-java.spec | 7 ++++++-
rel-eng/packages/spacewalk-java | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
New commits:
commit f29d925c7a0c797a6b21cdaeaeb62cdaff103a58
Author: Martin Minar <mminar(a)redhat.com>
Date: Fri Sep 2 11:36:32 2011 +0200
Automatic commit of package [spacewalk-java] release [1.6.35-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 00e5f8a..8a49b25 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -17,7 +17,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.6.34
+Version: 1.6.35
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -547,6 +547,11 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Fri Sep 02 2011 Martin Minar <mminar(a)redhat.com> 1.6.35-1
+- 734799 - New API: configchannel.getFileRevision (mzazrivec(a)redhat.com)
+- 734799 - New API: configchannel.getFileRevisions (mzazrivec(a)redhat.com)
+- 734799 - New API: configchannel.deleteFileRevisions (mzazrivec(a)redhat.com)
+
* Wed Aug 31 2011 Tomas Lestach <tlestach(a)redhat.com> 1.6.34-1
- fix NPE for KickstartDetailsEditAction (tlestach(a)redhat.com)
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index fdd51c3..74b0810 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.6.34-1 java/
+1.6.35-1 java/
12 years, 8 months
2 commits - backend/server backend/spacewalk-backend.spec rel-eng/packages
by Michael Mraka
backend/server/importlib/backendLib.py | 32 ++++++++++----------------------
backend/spacewalk-backend.spec | 5 ++++-
rel-eng/packages/spacewalk-backend | 2 +-
3 files changed, 15 insertions(+), 24 deletions(-)
New commits:
commit 7541241397531a7e7f2089759fe8f5fd1d321880
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Sep 2 10:44:55 2011 +0200
Automatic commit of package [spacewalk-backend] release [1.6.15-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index e443adc..241de83 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -11,7 +11,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2 and Python
-Version: 1.6.14
+Version: 1.6.15
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -674,6 +674,9 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
+* Fri Sep 02 2011 Michael Mraka <michael.mraka(a)redhat.com> 1.6.15-1
+- 735059 - modified TableInsert to use our direct blob insert
+
* Thu Sep 01 2011 Michael Mraka <michael.mraka(a)redhat.com> 1.6.14-1
- implemented include/exclude package filtering for spacewalk-repo-sync
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index ff28014..af529ce 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-1.6.14-1 backend/
+1.6.15-1 backend/
commit 16a5943fda761f2c6b27e02e9ca8ea515bc0426e
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Aug 31 22:49:04 2011 +0200
735059 - modified TableInsert to use our direct blob insert
fixing
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/spacewalk/server/apacheUploadServer.py", line 100, in _wrapper
ret = function(req)
File "/usr/share/rhn/upload_server/handlers/package_push/package_push.py", line 136, in handler
relative_path=self.rel_package_path, org_id=self.org_id)
...
File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/backend.py", line 1644, in __doInsertTable
insertObj.query(hash)
File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/backendLib.py", line 441, in query
self._update_blobs(blobValuesHash)
File "/usr/lib/python2.4/site-packages/spacewalk/server/importlib/backendLib.py", line 353, in _update_blobs
if blob.size() > len_v:
AttributeError: 'buffer' object has no attribute 'size'
diff --git a/backend/server/importlib/backendLib.py b/backend/server/importlib/backendLib.py
index db280d2..484294a 100644
--- a/backend/server/importlib/backendLib.py
+++ b/backend/server/importlib/backendLib.py
@@ -209,12 +209,12 @@ class BaseTableLookup:
# Stub
return None
- def _getCachedQuery(self, key):
+ def _getCachedQuery(self, key, blob_map=None):
if self.queries.has_key(key):
# Serve it from the pool
return self.queries[key]
- statement = self.dbmodule.prepare(self._buildQuery(key))
+ statement = self.dbmodule.prepare(self._buildQuery(key), blob_map=blob_map)
# And save it to the cached queries pool
self.queries[key] = statement
return statement
@@ -408,9 +408,7 @@ class TableInsert(TableUpdate):
self.count = 1000
self.insert_fields = self.pks + self.otherfields + self.blob_fields
- self.insert_values = map(lambda x: ':%s' % x, self.pks + self.otherfields)
- for f in self.blob_fields:
- self.insert_values.append('empty_blob()')
+ self.insert_values = map(lambda x: ':%s' % x, self.pks + self.otherfields + self.blob_fields)
def _buildQuery(self, key):
q = self.queryTemplate % (self.table.name,
@@ -419,27 +417,17 @@ class TableInsert(TableUpdate):
return q
def query(self, values):
- # Take the blob values out of the hash
- blob_values = {}
- for f in self.blob_fields:
- blob_values[f] = values[f]
- del values[f]
- # Copy the primary keys too
- for f in self.pks:
- blob_values[f] = values[f][:]
+ if self.blob_fields:
+ blob_map = {}
+ for f in self.blob_fields:
+ blob_map[f] = f
+ else:
+ blob_map = None
# Do the insert
- statement = self._getCachedQuery(None)
+ statement = self._getCachedQuery(None, blob_map=blob_map)
executeStatement(statement, values, self.count)
- if not self.blob_fields:
- # Nothing else to do
- return
-
- valuesHash, blobValuesHash = self._split_blob_values(blob_values, blob_only=1)
-
- self._update_blobs(blobValuesHash)
-
def executeStatement(statement, valuesHash, chunksize):
# Executes a statement with chunksize values at the time
12 years, 8 months
Changes to 'refs/tags/spacewalk-backend-1.6.15-1'
by Michael Mraka
Tag 'spacewalk-backend-1.6.15-1' created by Michael Mraka <michael.mraka(a)redhat.com> at 2011-09-02 08:44 +0000
Tagging package [spacewalk-backend] version [1.6.15-1] in directory [backend/].
Changes since spacewalk-backend-1.6.14-1:
Michael Mraka (2):
735059 - modified TableInsert to use our direct blob insert
Automatic commit of package [spacewalk-backend] release [1.6.15-1].
Milan Zazrivec (3):
734799 - New API: configchannel.deleteFileRevisions
734799 - New API: configchannel.getFileRevisions
734799 - New API: configchannel.getFileRevision
---
backend/server/importlib/backendLib.py | 32 +--
backend/spacewalk-backend.spec | 5
java/code/src/com/redhat/rhn/domain/config/ConfigRevision.hbm.xml | 9
java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java | 27 ++
java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java | 98 ++++++++++
java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java | 39 +++
rel-eng/packages/spacewalk-backend | 2
7 files changed, 188 insertions(+), 24 deletions(-)
---
12 years, 8 months
3 commits - java/code
by Milan Zazrivec
java/code/src/com/redhat/rhn/domain/config/ConfigRevision.hbm.xml | 9
java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java | 27 ++
java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java | 98 ++++++++++
java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java | 39 +++
4 files changed, 173 insertions(+)
New commits:
commit 130e2cea44de094d0c2b1fd919630090e56ef508
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Sep 1 15:37:17 2011 +0200
734799 - New API: configchannel.getFileRevision
New API call to get a particular config file revision.
The call accepts following arguments:
* config channel label (string)
* config file path (string)
* config file revision (integer)
In case of success, the call returns config revision (hash with
complete information), traceback otherwise.
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
index 8e3e116..695fcfb 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
@@ -161,6 +161,41 @@ public class ConfigChannelHandler extends BaseHandler {
}
/**
+ * Get revision for specified config file
+ * @param sessionKey User's session key.
+ * @param configChannelLabel Config channel label.
+ * @param filePath The configuration file path.
+ * @param revision The configuration file revision.
+ * @return Revisions of the configuration file, errors out otherwise.
+ *
+ * @xmlrpc.doc Get revision of the specified config file
+ * @xmlrpc.param #session_key()
+ * @xmlrpc.param #param_desc("string", "configChannelLabel",
+ * "label of config channel to lookup on")
+ * @xmlrpc.param #param_desc("string", "filePath", "config file path to examine")
+ * @xmlrpc.param #param_desc("int", "revision", "config file revision to examine")
+ * @xmlrpc.returntype
+ * $ConfigRevisionSerializer
+ */
+ public ConfigRevision getFileRevision(String sessionKey, String configChannelLabel,
+ String filePath, Integer revision) {
+ User loggedInUser = getLoggedInUser(sessionKey);
+ XmlRpcConfigChannelHelper configHelper = XmlRpcConfigChannelHelper.getInstance();
+ ConfigChannel cc = configHelper.lookupGlobal(loggedInUser, configChannelLabel);
+ ConfigurationManager cm = ConfigurationManager.getInstance();
+ ConfigFile cf = cm.lookupConfigFile(loggedInUser, cc.getId(), filePath);
+
+ if (cf == null) {
+ throw new FaultException(1022, "InvalidConfigFileException",
+ "Could not find configuration file with filePath=: " + filePath);
+ }
+
+ ConfigRevision cr = cm.lookupConfigRevisionByRevId(loggedInUser, cf,
+ revision.longValue());
+ return cr;
+ }
+
+ /**
* Return a struct of config channel details.
* @param sessionKey User's session key.
* @param configChannelLabel Config channel label.
commit 5067a62c15a29f47da377ca03c7587f3f9f918fe
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Sep 1 13:53:43 2011 +0200
734799 - New API: configchannel.getFileRevisions
New API call to list available config file revisions.
The call accepts following arguments:
* config channel label (string)
* config file path (string)
In case of success, the call returns list of config revisions
(hash with complete information), traceback otherwise.
diff --git a/java/code/src/com/redhat/rhn/domain/config/ConfigRevision.hbm.xml b/java/code/src/com/redhat/rhn/domain/config/ConfigRevision.hbm.xml
index c4fe45d..ac7fecb 100644
--- a/java/code/src/com/redhat/rhn/domain/config/ConfigRevision.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/config/ConfigRevision.hbm.xml
@@ -38,4 +38,8 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
where cr.revision = :rev and
cr.configFile = :cf]]>
</query>
+ <query name="ConfigRevision.findByConfigFile">
+ <![CDATA[from com.redhat.rhn.domain.config.ConfigRevision as cr
+ where cr.configFile = :cf]]>
+ </query>
</hibernate-mapping>
diff --git a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
index b0e2465..a7122be 100644
--- a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
@@ -423,6 +423,18 @@ public class ConfigurationFactory extends HibernateFactory {
}
/**
+ * Finds configuration revisions for a given configuration file
+ * @param cf The ConfigFile to look for.
+ * @return List of configuration revisions for given configuration file.
+ */
+ public static List lookupConfigRevisions(ConfigFile cf) {
+ Session session = HibernateFactory.getSession();
+ Query q = session.getNamedQuery("ConfigRevision.findByConfigFile");
+ q.setEntity("cf", cf);
+ return (List<ConfigRevision>) q.list();
+ }
+
+ /**
* Finds a ConfigInfo from the database with a given id.
* @param id The identifier for the ConfigInfo
* @return The sought for ConfigInfo or null if not found.
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
index f6e7047..8e3e116 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
@@ -124,6 +124,43 @@ public class ConfigChannelHandler extends BaseHandler {
}
/**
+ * Get list of revisions for specified config file
+ * @param sessionKey User's session key.
+ * @param configChannelLabel Config channel label.
+ * @param filePath The configuration file path.
+ * @return List of revisions of the configuration file, errors out otherwise.
+ *
+ * @xmlrpc.doc Get list of revisions for specified config file
+ * @xmlrpc.param #session_key()
+ * @xmlrpc.param #param_desc("string", "channelLabel",
+ * "label of config channel to lookup on")
+ * @xmlrpc.param
+ * #param_desc("string", "config file path to examine")
+ * @xmlrpc.returntype
+ * #array()
+ * $ConfigRevisionSerializer
+ * #array_end()
+ */
+ public List getFileRevisions(String sessionKey, String configChannelLabel,
+ String filePath) {
+ User loggedInUser = getLoggedInUser(sessionKey);
+ XmlRpcConfigChannelHelper configHelper = XmlRpcConfigChannelHelper.getInstance();
+ ConfigChannel cc = configHelper.lookupGlobal(loggedInUser, configChannelLabel);
+ ConfigurationManager cm = ConfigurationManager.getInstance();
+ ConfigFile cf = cm.lookupConfigFile(loggedInUser, cc.getId(), filePath);
+
+ if (cf == null) {
+ throw new FaultException(1022, "InvalidConfigFileException",
+ "Could not find configuration file with filePath=: " + filePath);
+ }
+
+ ArrayList<ConfigRevision> revisions =
+ (ArrayList<ConfigRevision>) cm.lookupConfigRevisions(cf);
+
+ return revisions;
+ }
+
+ /**
* Return a struct of config channel details.
* @param sessionKey User's session key.
* @param configChannelLabel Config channel label.
diff --git a/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java b/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
index a36c0fb..8fcf22a 100644
--- a/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
+++ b/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
@@ -1914,6 +1914,15 @@ public class ConfigurationManager extends BaseManager {
}
/**
+ * For a given configuration file, return list of config revisions
+ * @param cf ConfigFile to lookup the revision for.
+ * @return List of config file revisions.
+ */
+ public List lookupConfigRevisions(ConfigFile cf) {
+ return ConfigurationFactory.lookupConfigRevisions(cf);
+ }
+
+ /**
* @param uid The user id
* @param ccid The config channel id
* @return whether the user with the given id can view the
commit 66852a112809b10e110186f5e604369cb42992f6
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Wed Aug 31 16:08:54 2011 +0200
734799 - New API: configchannel.deleteFileRevisions
New API call to delete arbitrary config file revision (if permissions permit).
The call accepts following arguments:
* config channel label (string)
* config file path (string)
* list of config file revisions to delete (list of integers)
The call returns 1 in case of success, traceback otherwise.
diff --git a/java/code/src/com/redhat/rhn/domain/config/ConfigRevision.hbm.xml b/java/code/src/com/redhat/rhn/domain/config/ConfigRevision.hbm.xml
index 685ee3c..c4fe45d 100644
--- a/java/code/src/com/redhat/rhn/domain/config/ConfigRevision.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/config/ConfigRevision.hbm.xml
@@ -33,4 +33,9 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
column="config_file_type_id"
cascade="none" />
</class>
+ <query name="ConfigRevision.findByRevisionAndConfigFile">
+ <![CDATA[from com.redhat.rhn.domain.config.ConfigRevision as cr
+ where cr.revision = :rev and
+ cr.configFile = :cf]]>
+ </query>
</hibernate-mapping>
diff --git a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
index 149f53c..b0e2465 100644
--- a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
@@ -407,6 +407,21 @@ public class ConfigurationFactory extends HibernateFactory {
return a;
}
+
+ /**
+ * Finds a ConfigRevision for a given ConfigFile and given revision id
+ * @param ConfigFile The ConfigFile to look for.
+ * @param rev_id The ConfigFile revision to look for.
+ * @return ConfigRevision The sought for ConfigRevision.
+ */
+ public static ConfigRevision lookupConfigRevisionByRevId(ConfigFile cf, Long rev_id) {
+ Session session = HibernateFactory.getSession();
+ Query q = session.getNamedQuery("ConfigRevision.findByRevisionAndConfigFile");
+ q.setLong("rev", rev_id.longValue());
+ q.setEntity("cf", cf);
+ return (ConfigRevision) q.uniqueResult();
+ }
+
/**
* Finds a ConfigInfo from the database with a given id.
* @param id The identifier for the ConfigInfo
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
index c68ac14..f6e7047 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
@@ -98,6 +98,32 @@ public class ConfigChannelHandler extends BaseHandler {
}
/**
+ * Delete specified revisions of a given configuration file
+ * @param sessionKey User's session key.
+ * @param configChannelLabel Config channel label.
+ * @param filePath The configuration file path.
+ * @param revisions List of configuration file revisions to delete.
+ * @return 1 if deletion succeeds, errors out otherwise.
+ */
+ public int deleteFileRevisions(String sessionKey, String configChannelLabel,
+ String filePath, List<Integer> revisions) {
+ User loggedInUser = getLoggedInUser(sessionKey);
+
+ XmlRpcConfigChannelHelper configHelper = XmlRpcConfigChannelHelper.getInstance();
+ ConfigChannel cc = configHelper.lookupGlobal(loggedInUser, configChannelLabel);
+ ConfigurationManager cm = ConfigurationManager.getInstance();
+ ConfigFile cf = cm.lookupConfigFile(loggedInUser, cc.getId(), filePath);
+
+ for (Integer rev_id : revisions) {
+ ConfigRevision cr = cm.lookupConfigRevisionByRevId(loggedInUser, cf,
+ rev_id.longValue());
+ cm.deleteConfigRevision(loggedInUser, cr);
+ }
+
+ return 1;
+ }
+
+ /**
* Return a struct of config channel details.
* @param sessionKey User's session key.
* @param configChannelLabel Config channel label.
diff --git a/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java b/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
index 0bd5853..a36c0fb 100644
--- a/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
+++ b/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
@@ -1884,6 +1884,36 @@ public class ConfigurationManager extends BaseManager {
}
/**
+ * For a given configuration file, looks up a config revision id
+ * @param user The user requesting to lookup a config revision.
+ * @param cf The ConfigFile that the revision applies to
+ * @param rev_id The ConfigFile revision id.
+ * @return The sought for config revision.
+ */
+ public ConfigRevision lookupConfigRevisionByRevId(User user, ConfigFile cf,
+ Long rev_id) {
+ ConfigRevision cr = ConfigurationFactory.lookupConfigRevisionByRevId(cf, rev_id);
+
+ if (cr == null) {
+ throw new LookupException("Could not find config revision with revision id="
+ + rev_id);
+ }
+
+ if (!accessToRevision(user.getId(), cr.getId())) {
+ LocalizationService ls = LocalizationService.getInstance();
+ LookupException e =
+ new LookupException("Could not find config revision with revision id="
+ + rev_id);
+ e.setLocalizedTitle(ls.getMessage("lookup.configrev.title"));
+ e.setLocalizedReason1(ls.getMessage("lookup.configrev.reason1"));
+ e.setLocalizedReason2(ls.getMessage("lookup.configrev.reason2"));
+ throw e;
+ }
+
+ return cr;
+ }
+
+ /**
* @param uid The user id
* @param ccid The config channel id
* @return whether the user with the given id can view the
12 years, 8 months