java/code
by StephenHerr
java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartScriptOrderAction.java | 2
java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptSetupActionTest.java | 46 -------
java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptsSetupActionTest.java | 46 +++++++
java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java | 13 +-
java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/test/ProfileHandlerTest.java | 64 ++++++++++
5 files changed, 122 insertions(+), 49 deletions(-)
New commits:
commit 6c888d530ac6141d4b3cc30649fcf51a57d20995
Author: Stephen Herr <sherr(a)redhat.com>
Date: Fri Oct 18 16:22:49 2013 -0400
1020497 - fixing a bug and adding a unit test for ordering kickstarts
diff --git a/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartScriptOrderAction.java b/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartScriptOrderAction.java
index ef6c008..b220917 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartScriptOrderAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartScriptOrderAction.java
@@ -196,7 +196,9 @@ public class KickstartScriptOrderAction extends RhnLookupDispatchAction {
// update scripts with the appropriate priorities
for (KickstartScript script : scripts) {
script.setPosition(oldToNew.get(fakeToOld.get(script.getPosition())));
+ HibernateFactory.getSession().save(script);
}
+ KickstartFactory.saveKickstartData(ksdata);
getStrutsDelegate().saveMessage("kickstart.script.order.success", request);
return getStrutsDelegate().forwardParam(mapping.findForward("success"),
diff --git a/java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptSetupActionTest.java b/java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptSetupActionTest.java
deleted file mode 100644
index 8563b6d..0000000
--- a/java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptSetupActionTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Copyright (c) 2009--2012 Red Hat, Inc.
- *
- * This software is licensed to you under the GNU General Public License,
- * version 2 (GPLv2). There is NO WARRANTY for this software, express or
- * implied, including the implied warranties of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
- * along with this software; if not, see
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
- *
- * Red Hat trademarks are not licensed under GPLv2. No permission is
- * granted to use or replicate Red Hat trademarks that are incorporated
- * in this software or its documentation.
- */
-package com.redhat.rhn.frontend.action.kickstart.test;
-
-import com.redhat.rhn.common.db.datasource.DataResult;
-import com.redhat.rhn.domain.kickstart.KickstartData;
-import com.redhat.rhn.domain.kickstart.test.KickstartDataTest;
-import com.redhat.rhn.frontend.action.kickstart.ScriptsSetupAction;
-import com.redhat.rhn.frontend.struts.RequestContext;
-import com.redhat.rhn.testing.RhnMockStrutsTestCase;
-import com.redhat.rhn.testing.UserTestUtils;
-
-/**
- * KickstartsSetupActionTest
- * @version $Rev: 1 $
- */
-public class ScriptSetupActionTest extends RhnMockStrutsTestCase {
-
- public void testKickstartList() throws Exception {
- // Create a kickstart and the defaults so the list
- // will return something.
- UserTestUtils.addProvisioning(user.getOrg());
- KickstartData k = KickstartDataTest.createTestKickstartData(user.getOrg());
- setRequestPathInfo("/kickstart/Scripts");
- addRequestParameter(RequestContext.KICKSTART_ID, k.getId().toString());
- actionPerform();
- DataResult dr = (DataResult) request.getAttribute(ScriptsSetupAction.LIST_NAME);
- assertNotNull(dr);
- assertTrue(dr.size() > 0);
-
- }
-
-}
-
diff --git a/java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptsSetupActionTest.java b/java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptsSetupActionTest.java
new file mode 100644
index 0000000..cc52ea5
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptsSetupActionTest.java
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2009--2012 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.frontend.action.kickstart.test;
+
+import com.redhat.rhn.common.db.datasource.DataResult;
+import com.redhat.rhn.domain.kickstart.KickstartData;
+import com.redhat.rhn.domain.kickstart.test.KickstartDataTest;
+import com.redhat.rhn.frontend.action.kickstart.ScriptsSetupAction;
+import com.redhat.rhn.frontend.struts.RequestContext;
+import com.redhat.rhn.testing.RhnMockStrutsTestCase;
+import com.redhat.rhn.testing.UserTestUtils;
+
+/**
+ * KickstartsSetupActionTest
+ * @version $Rev: 1 $
+ */
+public class ScriptsSetupActionTest extends RhnMockStrutsTestCase {
+
+ public void testKickstartList() throws Exception {
+ // Create a kickstart and the defaults so the list
+ // will return something.
+ UserTestUtils.addProvisioning(user.getOrg());
+ KickstartData k = KickstartDataTest.createTestKickstartData(user.getOrg());
+ setRequestPathInfo("/kickstart/Scripts");
+ addRequestParameter(RequestContext.KICKSTART_ID, k.getId().toString());
+ actionPerform();
+ DataResult dr = (DataResult) request.getAttribute(ScriptsSetupAction.LIST_NAME);
+ assertNotNull(dr);
+ assertTrue(dr.size() > 0);
+
+ }
+
+}
+
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java
index e1e6f14..4f16b34 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java
@@ -511,17 +511,24 @@ public class ProfileHandler extends BaseHandler {
Long nextPosition = 1L;
Long nextNegativePosition = -1L;
for (Integer id : preScripts) {
- idToScript.get(id).setPosition(nextPosition);
+ KickstartScript script = idToScript.get(id);
+ script.setPosition(nextPosition);
nextPosition += 1;
+ HibernateFactory.getSession().save(script);
}
for (Integer id : postScriptsBeforeRegistration) {
- idToScript.get(id).setPosition(nextNegativePosition);
+ KickstartScript script = idToScript.get(id);
+ script.setPosition(nextNegativePosition);
nextNegativePosition -= 1;
+ HibernateFactory.getSession().save(script);
}
for (Integer id : postScriptsAfterRegistration) {
- idToScript.get(id).setPosition(nextPosition);
+ KickstartScript script = idToScript.get(id);
+ script.setPosition(nextPosition);
nextPosition += 1;
+ HibernateFactory.getSession().save(script);
}
+ KickstartFactory.saveKickstartData(data);
return 1;
}
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/test/ProfileHandlerTest.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/test/ProfileHandlerTest.java
index bda9ff8..bb12aa3 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/test/ProfileHandlerTest.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/test/ProfileHandlerTest.java
@@ -169,6 +169,70 @@ public class ProfileHandlerTest extends BaseHandlerTestCase {
assertTrue(found);
}
+ public void testOrderScripts() throws Exception {
+ KickstartData ks = KickstartDataTest.createKickstartWithChannel(admin.getOrg());
+ // delete kickstart scripts that are already there
+ List<KickstartScript> scripts = handler.listScripts(adminKey, ks.getLabel());
+ for (KickstartScript script : scripts) {
+ handler.removeScript(adminKey, ks.getLabel(), script.getId().intValue());
+ }
+ ks = (KickstartData) HibernateFactory.reload(ks);
+
+ int idPost1 =
+ handler.addScript(adminKey, ks.getLabel(), "myPost1", "This is a script",
+ "", "post", true);
+ int idPost2 =
+ handler.addScript(adminKey, ks.getLabel(), "myPost2", "This is a script",
+ "", "post", true);
+ int idPostNochroot1 =
+ handler.addScript(adminKey, ks.getLabel(), "myPostNochroot1",
+ "This is a script", "", "post", false);
+ int idPostNochroot2 =
+ handler.addScript(adminKey, ks.getLabel(), "myPostNochroot2",
+ "This is a script", "", "post", false);
+ int idPre1 =
+ handler.addScript(adminKey, ks.getLabel(), "myPre1", "This is a script",
+ "", "pre", false);
+ int idPre2 =
+ handler.addScript(adminKey, ks.getLabel(), "myPre2", "This is a script",
+ "", "pre", false);
+ ks = (KickstartData) HibernateFactory.reload(ks);
+
+ // make sure they're in the proper order initially
+ scripts = handler.listScripts(adminKey, ks.getLabel());
+ assertNotNull(scripts);
+ assertEquals(6, scripts.size());
+ assertEquals(idPre1, scripts.get(0).getId().intValue());
+ assertEquals(scripts.get(1).getId().intValue(), idPre2);
+ assertEquals(scripts.get(2).getId().intValue(), idPostNochroot1);
+ assertEquals(scripts.get(3).getId().intValue(), idPostNochroot2);
+ assertEquals(scripts.get(4).getId().intValue(), idPost1);
+ assertEquals(scripts.get(5).getId().intValue(), idPost2);
+
+ List<Integer> orderedPre = new ArrayList<Integer>();
+ List<Integer> orderedPostBefore = new ArrayList<Integer>();
+ List<Integer> orderedPostAfter = new ArrayList<Integer>();
+ orderedPre.add(idPre2);
+ orderedPre.add(idPre1);
+ orderedPostBefore.add(idPost1);
+ orderedPostBefore.add(idPostNochroot1);
+ orderedPostAfter.add(idPost2);
+ orderedPostAfter.add(idPostNochroot2);
+
+ //make the acutal call
+ handler.orderScripts(adminKey, ks.getLabel(), orderedPre, orderedPostBefore,
+ orderedPostAfter);
+
+ //test results
+ scripts = handler.listScripts(adminKey, ks.getLabel());
+ assertTrue(scripts.get(0).getId().intValue() == idPre2);
+ assertTrue(scripts.get(1).getId().intValue() == idPre1);
+ assertTrue(scripts.get(2).getId().intValue() == idPost1);
+ assertTrue(scripts.get(3).getId().intValue() == idPostNochroot1);
+ assertTrue(scripts.get(4).getId().intValue() == idPost2);
+ assertTrue(scripts.get(5).getId().intValue() == idPostNochroot2);
+ }
+
public void testAddScript() throws Exception {
KickstartData ks = KickstartDataTest.createKickstartWithChannel(admin.getOrg());
int id = handler.addScript(adminKey, ks.getLabel(), "sample",
10 years, 5 months
Changes to 'refs/tags/spacewalk-backend-2.1.29-1'
by Michael Mraka
Tag 'spacewalk-backend-2.1.29-1' created by Michael Mraka <michael.mraka(a)redhat.com> at 2013-10-18 15:49 +0000
Tagging package [spacewalk-backend] version [2.1.29-1] in directory [backend/].
Changes since spacewalk-schema-2.1.21-1:
Michael Mraka (5):
891880 - make sure we put strings to fd.write()
891880 - reuse stringutils functions
replace encode/decode with to_string/to_unicode
include stringutils into package
Automatic commit of package [spacewalk-backend] release [2.1.29-1].
Milan Zazrivec (1):
1020910 - use sha1 to compare checksums
Silvio Moioli (2):
Update ScriptSetupActionTest for new attribute name
Cobbler tests: added missing return
---
backend/common/Makefile | 3 -
backend/common/fileutils.py | 2
backend/common/rhnMail.py | 7 +-
backend/common/rhnTB.py | 26 ++++----
backend/common/stringutils.py | 29 ++++++++++
backend/satellite_tools/sync_handlers.py | 3 -
backend/server/action_extra_data/configfiles.py | 5 -
backend/server/importlib/debPackage.py | 4 -
backend/server/importlib/headerSource.py | 3 -
backend/server/rhnSQL/driver_cx_Oracle.py | 8 +-
backend/server/rhnSQL/sql_base.py | 7 --
backend/server/rhnServer/server_certificate.py | 8 +-
backend/spacewalk-backend.spec | 10 +++
java/code/src/com/redhat/rhn/frontend/action/kickstart/ScriptsSetupAction.java | 2
java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptSetupActionTest.java | 3 -
java/code/src/org/cobbler/test/MockConnection.java | 1
rel-eng/packages/spacewalk-backend | 2
17 files changed, 76 insertions(+), 47 deletions(-)
---
10 years, 5 months
5 commits - backend/common backend/satellite_tools backend/server backend/spacewalk-backend.spec rel-eng/packages
by Michael Mraka
backend/common/Makefile | 3 +-
backend/common/rhnMail.py | 7 ++---
backend/common/rhnTB.py | 26 +++++++++------------
backend/common/stringutils.py | 29 ++++++++++++++++++++++++
backend/satellite_tools/sync_handlers.py | 3 +-
backend/server/action_extra_data/configfiles.py | 5 +---
backend/server/importlib/debPackage.py | 4 +--
backend/server/importlib/headerSource.py | 3 +-
backend/server/rhnSQL/driver_cx_Oracle.py | 8 +++---
backend/server/rhnSQL/sql_base.py | 7 -----
backend/server/rhnServer/server_certificate.py | 8 ++----
backend/spacewalk-backend.spec | 10 +++++++-
rel-eng/packages/spacewalk-backend | 2 -
13 files changed, 71 insertions(+), 44 deletions(-)
New commits:
commit c76bdce4339c262ff1025e20dc70599ef9d96426
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 18 17:49:08 2013 +0200
Automatic commit of package [spacewalk-backend] release [2.1.29-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 44ab6ee..438aace 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
-Version: 2.1.28
+Version: 2.1.29
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -628,6 +628,13 @@ rm -f %{rhnconf}/rhnSecret.py*
%{pythonrhnroot}/satellite_tools/exporter/xmlWriter.py*
%changelog
+* Fri Oct 18 2013 Michael Mraka <michael.mraka(a)redhat.com> 2.1.29-1
+- include stringutils into package
+- replace encode/decode with to_string/to_unicode
+- 891880 - reuse stringutils functions
+- 891880 - make sure we put strings to fd.write()
+- 1020910 - use sha1 to compare checksums
+
* Tue Oct 15 2013 Michael Mraka <michael.mraka(a)redhat.com> 2.1.28-1
- python pgsql tests: made easier Jenkins integration
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index 37e8bc2..b8c4508 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-2.1.28-1 backend/
+2.1.29-1 backend/
commit 8c7ac8621dcddf6bcb8d1fb3fe9fe75a6ca0b23f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 18 17:26:44 2013 +0200
include stringutils into package
diff --git a/backend/common/Makefile b/backend/common/Makefile
index 50c2e38..e6ebcc3 100644
--- a/backend/common/Makefile
+++ b/backend/common/Makefile
@@ -27,7 +27,8 @@ SPACEWALK_FILES = __init__ \
rhn_deb \
rhn_mpm \
rhn_pkg \
- rhn_rpm
+ rhn_rpm \
+ stringutils
SCRIPTS = spacewalk-cfg-get
# check if we can build man pages
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index a4bbd9a..44ab6ee 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -512,6 +512,7 @@ rm -f %{rhnconf}/rhnSecret.py*
%{pythonrhnroot}/common/rhn_mpm.py*
%{pythonrhnroot}/common/rhn_pkg.py*
%{pythonrhnroot}/common/rhn_rpm.py*
+%{pythonrhnroot}/common/stringutils.py*
%files config-files-common
%doc LICENSE
commit f495b53debaec8289c53a233a230895dc74d1e80
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri May 3 18:32:25 2013 +0200
replace encode/decode with to_string/to_unicode
diff --git a/backend/satellite_tools/sync_handlers.py b/backend/satellite_tools/sync_handlers.py
index 481d263..4d048c5 100644
--- a/backend/satellite_tools/sync_handlers.py
+++ b/backend/satellite_tools/sync_handlers.py
@@ -18,6 +18,7 @@ import types
import string
import sys
+from spacewalk.common.stringutils import to_string
from spacewalk.server import rhnSQL
from spacewalk.server.importlib import channelImport, packageImport, errataImport, \
kickstartImport, importLib
@@ -598,7 +599,7 @@ def populate_channel_family_permissions(cert):
# default the org to 1 for channel families from cert
org_id = 1
- cf_name = cf_name.encode('utf-8')
+ cf_name = to_string(cf_name)
try:
old_max_tuple = cfps[(cf_name, org_id)]
except KeyError:
diff --git a/backend/server/action_extra_data/configfiles.py b/backend/server/action_extra_data/configfiles.py
index fa62303..c232aa2 100644
--- a/backend/server/action_extra_data/configfiles.py
+++ b/backend/server/action_extra_data/configfiles.py
@@ -15,9 +15,9 @@
# config file-related error handling functions
#
-from types import UnicodeType
from spacewalk.common import rhnFlags
from spacewalk.common.rhnLog import log_debug, log_error
+from spacewalk.common.stringutils import to_string
from spacewalk.server import rhnSQL
from spacewalk.server.rhnServer import server_kickstart
@@ -269,8 +269,7 @@ def _add_result(action_config_revision_id, diff):
if diff:
blob_map = {'result': 'result'}
- if type(diff) == UnicodeType:
- diff = unicode.encode(diff,'utf-8')
+ diff = to_string(diff)
else:
blob_map = None
diff = None
diff --git a/backend/server/importlib/debPackage.py b/backend/server/importlib/debPackage.py
index 99f5c90..b799e3b 100644
--- a/backend/server/importlib/debPackage.py
+++ b/backend/server/importlib/debPackage.py
@@ -22,7 +22,7 @@ import string
from importLib import Channel
from backendLib import gmtime, localtime
from types import IntType
-
+from spacewalk.common.stringutils import to_string
class debBinaryPackage(headerSource.rpmBinaryPackage):
@@ -62,7 +62,7 @@ class debBinaryPackage(headerSource.rpmBinaryPackage):
elif val:
# Convert to strings
if isinstance(val, unicode):
- val = unicode.encode(val, 'utf-8')
+ val = to_string(val)
else:
val = str(val)
elif val == []:
diff --git a/backend/server/importlib/headerSource.py b/backend/server/importlib/headerSource.py
index 37026fd..7933d29 100644
--- a/backend/server/importlib/headerSource.py
+++ b/backend/server/importlib/headerSource.py
@@ -24,6 +24,7 @@ from importLib import File, Dependency, ChangeLog, Channel, \
from backendLib import gmtime, localtime
from types import ListType, TupleType, IntType, LongType, StringType
from spacewalk.common.rhnLog import log_debug
+from spacewalk.common.stringutils import to_string
class rpmPackage(IncompletePackage):
# Various mappings
@@ -65,7 +66,7 @@ class rpmPackage(IncompletePackage):
elif val:
# Convert to strings
if isinstance(val, unicode):
- val = unicode.encode(val, 'utf-8')
+ val = to_string(val)
else:
val = str(val)
elif val == []:
diff --git a/backend/server/rhnSQL/driver_cx_Oracle.py b/backend/server/rhnSQL/driver_cx_Oracle.py
index 03575da..0af3df6 100644
--- a/backend/server/rhnSQL/driver_cx_Oracle.py
+++ b/backend/server/rhnSQL/driver_cx_Oracle.py
@@ -34,7 +34,7 @@ from spacewalk.server import rhnSQL
from spacewalk.common import rhnConfig
from spacewalk.common.rhnLog import log_debug, log_error
from spacewalk.common.rhnException import rhnException
-from sql_base import adjust_type
+from spacewalk.common.stringutils import to_string
from const import ORACLE
ORACLE_TYPE_MAPPING = [
@@ -154,7 +154,7 @@ class Cursor(sql_base.Cursor):
if not _p.has_key(k):
# Raise the fault ourselves
raise sql_base.SQLError(1008, 'Not all variables bound', k)
- params[k] = adjust_type(_p[k])
+ params[k] = to_string(_p[k])
# cx_Oracle expects the first arg to be the statement and no
# positional args:
@@ -194,7 +194,7 @@ class Cursor(sql_base.Cursor):
for i in xrange(item_count):
pdict = arr[i]
for k, v in kwargs.iteritems():
- pdict[k] = adjust_type(v[start+i])
+ pdict[k] = to_string(v[start+i])
# We clear self->bindVariables so that list of all nulls
# in the previous chunk which caused the type to be set to
@@ -326,7 +326,7 @@ class Procedure(sql_base.Procedure):
return self._call_proc_ret(args, ret_type=None)
def _call_proc_ret(self, args, ret_type=None):
- args = map(adjust_type, self._munge_args(args))
+ args = map(to_string, self._munge_args(args))
if ret_type:
for sqltype, db_type in self._type_mapping:
if isinstance(ret_type, sqltype):
diff --git a/backend/server/rhnSQL/sql_base.py b/backend/server/rhnSQL/sql_base.py
index f76c2e1..e1ce75a 100644
--- a/backend/server/rhnSQL/sql_base.py
+++ b/backend/server/rhnSQL/sql_base.py
@@ -28,13 +28,6 @@ import sys
import sql_types
import types
-def adjust_type(val):
- """ Adjust data types prior to calling execute(). """
- if isinstance(val, types.UnicodeType):
- # Represent it as UTF8
- return val.encode("UTF8")
- return val
-
def ociDict(names=None, row=None):
""" Create a dictionary from a row description and its values. """
data = {}
diff --git a/backend/server/rhnServer/server_certificate.py b/backend/server/rhnServer/server_certificate.py
index 30ee545..5d2e3ed 100644
--- a/backend/server/rhnServer/server_certificate.py
+++ b/backend/server/rhnServer/server_certificate.py
@@ -26,6 +26,7 @@ import xmlrpclib
from spacewalk.common.rhnLog import log_debug, log_error
from spacewalk.common.rhnException import rhnFault
+from spacewalk.common.stringutils import to_string
from server_lib import getServerSecret
def gen_secret():
@@ -56,7 +57,7 @@ class Checksum:
else:
if type(arg) == type(0):
arg = str(arg)
- self.sum.update(arg.encode("utf-8"))
+ self.sum.update(to_string(arg))
def __repr__(self):
t = ""
for i in self.sum.digest()[:]:
@@ -141,10 +142,7 @@ class Certificate:
return -1
# Now decode this certificate
try:
- if isinstance(text_id, unicode):
- sysid, junk = xmlrpclib.loads(text_id.encode('utf-8'))
- else:
- sysid, junk = xmlrpclib.loads(text_id)
+ sysid, junk = xmlrpclib.loads(to_string(text_id))
except:
return -1
else:
commit c75009845c65d9a956238b46f52931c6fd2ae4c4
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri May 3 17:42:47 2013 +0200
891880 - reuse stringutils functions
diff --git a/backend/common/rhnMail.py b/backend/common/rhnMail.py
index 2059c59..684fced 100644
--- a/backend/common/rhnMail.py
+++ b/backend/common/rhnMail.py
@@ -20,6 +20,7 @@ import smtplib
from rhnConfig import CFG, PRODUCT_NAME
from rhn.connections import idn_pune_to_unicode
+from stringutils import to_string
# check if the headers have the minimum required fields
def __check_headers(h):
@@ -53,8 +54,6 @@ def send(headers, body, sender = None):
joined_headers += u"%s: %s\n" % (h, headers[h])
server = smtplib.SMTP('localhost')
- if not isinstance(body, unicode):
- body = body.decode('utf-8')
- msg = u"%s\n%s\n" % (joined_headers, body)
- server.sendmail(sender, toaddrs, msg.encode('utf-8'))
+ msg = "%s\n%s\n" % (to_string(joined_headers), to_string(body))
+ server.sendmail(sender, toaddrs, msg)
server.quit()
commit e8628e3b3decc8502f4914d9f60c1d5e1dee3bd6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri May 3 17:13:55 2013 +0200
891880 - make sure we put strings to fd.write()
diff --git a/backend/common/rhnTB.py b/backend/common/rhnTB.py
index 209cac3..9c77f58 100644
--- a/backend/common/rhnTB.py
+++ b/backend/common/rhnTB.py
@@ -24,6 +24,7 @@ from rhn.connections import idn_pune_to_unicode
from rhnConfig import CFG, PRODUCT_NAME
from rhnLog import log_error
from rhnTranslate import _
+from stringutils import to_string
import rhnMail
import rhnFlags
@@ -44,7 +45,7 @@ def print_env(fd = sys.stderr):
el = dct.keys()
el.sort()
for k in el:
- fd.write("%s = %s\n" % (k, dct[k]))
+ fd.write("%s = %s\n" % (to_string(k), to_string(dct[k])))
def print_locals(fd = sys.stderr, tb = None):
@@ -70,13 +71,13 @@ def print_locals(fd = sys.stderr, tb = None):
frame.f_code.co_filename,
frame.f_lineno))
for key, value in frame.f_locals.items():
- fd.write("\t%20s = " % key)
+ fd.write("\t%20s = " % to_string(key))
# We have to be careful not to cause a new error in our error
# printer! Calling str() on an unknown object could cause an
# error we don't want.
# pylint: disable=W0702
try:
- s = str(value)
+ s = str(to_string(value))
except:
s = "<ERROR WHILE PRINTING VALUE>"
if len(s) > 100 * 1024:
@@ -98,7 +99,7 @@ def print_req(req, fd = sys.stderr):
kl = req.headers_in.keys()
kl.sort()
for k in kl:
- fd.write("\t%s: %s\n" % (k, req.headers_in[k]))
+ fd.write("\t%s: %s\n" % (to_string(k), to_string(req.headers_in[k])))
return 0
@@ -126,16 +127,16 @@ def Traceback(method = None, req = None, mail = 1, ostream = sys.stderr,
exc = StringIO()
unicode_hostname = idn_pune_to_unicode(hostname)
- exc.write("Exception reported from %s\nTime: %s\n" % (unicode_hostname, t))
- exc.write("Exception type %s\n" % (e_type,))
+ exc.write("Exception reported from %s\nTime: %s\n" % (to_string(unicode_hostname), t))
+ exc.write("Exception type %s\n" % to_string(e_type))
if method:
- exc.write("Exception while handling function %s\n" % method)
+ exc.write("Exception while handling function %s\n" % to_string(method))
# print information about the request being served
if req:
print_req(req, exc)
if extra:
- exc.write("Extra information about this error:\n%s\n" % extra)
+ exc.write("Extra information about this error:\n%s\n" % to_string(extra))
# Print the traceback
exc.write("\nException Handler Information\n")
@@ -147,11 +148,8 @@ def Traceback(method = None, req = None, mail = 1, ostream = sys.stderr,
# we always log it somewhere
if ostream:
- msg = exc.getvalue()
- if isinstance(msg, unicode):
- msg = msg.encode('utf-8')
- ostream.write("%s\n" % msg)
-
+ ostream.write(to_string(exc.getvalue()))
+ ostream.write("\n")
if mail:
# print the stack frames for the mail we send out
@@ -175,7 +173,7 @@ def Traceback(method = None, req = None, mail = 1, ostream = sys.stderr,
}
QUIET_MAIL = QUIET_MAIL - 1 # count it no matter what
- outstring = exc.getvalue()
+ outstring = to_string(exc.getvalue())
#5/18/05 wregglej - 151158 Go through every string in the security list
# and censor it out of the debug information.
diff --git a/backend/common/stringutils.py b/backend/common/stringutils.py
new file mode 100644
index 0000000..b7d8715
--- /dev/null
+++ b/backend/common/stringutils.py
@@ -0,0 +1,29 @@
+#
+# Copyright (c) 2013 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+
+from types import StringType, UnicodeType
+
+
+def to_unicode(obj):
+ if type(obj) == StringType:
+ return unicode(obj, 'utf8')
+ else:
+ return obj
+
+def to_string(obj):
+ if type(obj) == UnicodeType:
+ return obj.encode('utf8')
+ else:
+ return obj
10 years, 5 months
backend/common
by Milan Zazrivec
backend/common/fileutils.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit a4d23af586196547fa8d3b867f0aed7922503ca8
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Fri Oct 18 15:59:17 2013 +0200
1020910 - use sha1 to compare checksums
md5 will not work on a FIPS enabled Spacewalk.
diff --git a/backend/common/fileutils.py b/backend/common/fileutils.py
index f8fc12f..fb4cb8b 100644
--- a/backend/common/fileutils.py
+++ b/backend/common/fileutils.py
@@ -107,7 +107,7 @@ def rotateFile(filepath, depth=5, suffix='.', verbosity=0):
% os.path.dirname(pathNSuffix))
# is there anything to do? (existence, then size, then checksum)
- checksum_type = 'md5' # FIXME: this should be configuation option
+ checksum_type = 'sha1'
if os.path.exists(pathNSuffix1) and os.path.isfile(pathNSuffix1) \
and os.stat(filepath)[6] == os.stat(pathNSuffix1)[6] \
and getFileChecksum(checksum_type, filepath) == \
10 years, 5 months
java/code
by Silvio Moioli
java/code/src/org/cobbler/test/MockConnection.java | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 6b7b0945b6b7a310ff76341ba7f7600bff3a5780
Author: Silvio Moioli <smoioli(a)suse.de>
Date: Fri Oct 18 11:50:26 2013 +0200
Cobbler tests: added missing return
diff --git a/java/code/src/org/cobbler/test/MockConnection.java b/java/code/src/org/cobbler/test/MockConnection.java
index 67e512a..105462c 100644
--- a/java/code/src/org/cobbler/test/MockConnection.java
+++ b/java/code/src/org/cobbler/test/MockConnection.java
@@ -233,6 +233,7 @@ public class MockConnection extends CobblerConnection {
}
else if ("remove_system".equals(name)) {
systems.remove(findByName((String)args[0], systems));
+ return true;
}
else if ("new_system".equals(name)) {
Map profile = new HashMap();
10 years, 5 months
java/code
by Silvio Moioli
java/code/src/com/redhat/rhn/frontend/action/kickstart/ScriptsSetupAction.java | 2 +-
java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptSetupActionTest.java | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
New commits:
commit 08f2d4b7b2d71c21004768fb2c2d8bd1d4d2e0d0
Author: Silvio Moioli <smoioli(a)suse.de>
Date: Fri Oct 18 12:05:28 2013 +0200
Update ScriptSetupActionTest for new attribute name
diff --git a/java/code/src/com/redhat/rhn/frontend/action/kickstart/ScriptsSetupAction.java b/java/code/src/com/redhat/rhn/frontend/action/kickstart/ScriptsSetupAction.java
index 88895c2..1e397d6 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/kickstart/ScriptsSetupAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/kickstart/ScriptsSetupAction.java
@@ -38,7 +38,7 @@ import com.redhat.rhn.manager.kickstart.KickstartLister;
*/
public class ScriptsSetupAction extends RhnAction {
- static final String LIST_NAME = "kickstart_scripts";
+ public static final String LIST_NAME = "kickstart_scripts";
/**
*
diff --git a/java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptSetupActionTest.java b/java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptSetupActionTest.java
index 9dae86f..8563b6d 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptSetupActionTest.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/kickstart/test/ScriptSetupActionTest.java
@@ -17,6 +17,7 @@ package com.redhat.rhn.frontend.action.kickstart.test;
import com.redhat.rhn.common.db.datasource.DataResult;
import com.redhat.rhn.domain.kickstart.KickstartData;
import com.redhat.rhn.domain.kickstart.test.KickstartDataTest;
+import com.redhat.rhn.frontend.action.kickstart.ScriptsSetupAction;
import com.redhat.rhn.frontend.struts.RequestContext;
import com.redhat.rhn.testing.RhnMockStrutsTestCase;
import com.redhat.rhn.testing.UserTestUtils;
@@ -35,7 +36,7 @@ public class ScriptSetupActionTest extends RhnMockStrutsTestCase {
setRequestPathInfo("/kickstart/Scripts");
addRequestParameter(RequestContext.KICKSTART_ID, k.getId().toString());
actionPerform();
- DataResult dr = (DataResult) request.getAttribute(RequestContext.PAGE_LIST);
+ DataResult dr = (DataResult) request.getAttribute(ScriptsSetupAction.LIST_NAME);
assertNotNull(dr);
assertTrue(dr.size() > 0);
10 years, 5 months
Changes to 'refs/tags/spacewalk-schema-2.1.21-1'
by StephenHerr
Tag 'spacewalk-schema-2.1.21-1' created by Stephen Herr <sherr(a)redhat.com> at 2013-10-17 19:25 +0000
Tagging package [spacewalk-schema] version [2.1.21-1] in directory [schema/spacewalk/].
Changes since spacewalk-java-2.1.57-1:
Stephen Herr (1):
Automatic commit of package [spacewalk-schema] release [2.1.21-1].
---
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
---
10 years, 5 months
rel-eng/packages schema/spacewalk
by StephenHerr
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit b57505d09c973e9e27063286fa81c22258172885
Author: Stephen Herr <sherr(a)redhat.com>
Date: Thu Oct 17 15:25:29 2013 -0400
Automatic commit of package [spacewalk-schema] release [2.1.21-1].
diff --git a/rel-eng/packages/spacewalk-schema b/rel-eng/packages/spacewalk-schema
index 211eaa1..258e22f 100644
--- a/rel-eng/packages/spacewalk-schema
+++ b/rel-eng/packages/spacewalk-schema
@@ -1 +1 @@
-2.1.20-1 schema/spacewalk/
+2.1.21-1 schema/spacewalk/
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index 099202d..b94be63 100644
--- a/schema/spacewalk/spacewalk-schema.spec
+++ b/schema/spacewalk/spacewalk-schema.spec
@@ -4,7 +4,7 @@ Name: spacewalk-schema
Group: Applications/Internet
Summary: Oracle SQL schema for Spacewalk server
-Version: 2.1.20
+Version: 2.1.21
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
@@ -71,6 +71,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/spacewalk-sql*
%changelog
+* Thu Oct 17 2013 Stephen Herr <sherr(a)redhat.com> 2.1.21-1
+- 1020497 - provide a way to order kickstart scripts
+
* Tue Sep 17 2013 Jan Dobes 2.1.20-1
- 820225 - recount associated virtual guests entitlements even in other orgs
10 years, 5 months
Changes to 'refs/tags/spacewalk-java-2.1.57-1'
by StephenHerr
Tag 'spacewalk-java-2.1.57-1' created by Stephen Herr <sherr(a)redhat.com> at 2013-10-17 19:17 +0000
Tagging package [spacewalk-java] version [2.1.57-1] in directory [java/].
Changes since spacewalk-branding-2.1.5-1:
Stephen Herr (2):
1020497 - re-applying fix from 122418187 that got missed in the merge in c821c7ee2
Automatic commit of package [spacewalk-java] release [2.1.57-1].
---
java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java | 4 +++-
java/spacewalk-java.spec | 6 +++++-
rel-eng/packages/spacewalk-java | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
---
10 years, 5 months
2 commits - java/code java/spacewalk-java.spec rel-eng/packages
by StephenHerr
java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java | 4 +++-
java/spacewalk-java.spec | 6 +++++-
rel-eng/packages/spacewalk-java | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
New commits:
commit 39a055142be622c3835f8922d6e32b2e73299fdb
Author: Stephen Herr <sherr(a)redhat.com>
Date: Thu Oct 17 15:17:20 2013 -0400
Automatic commit of package [spacewalk-java] release [2.1.57-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 678a35c..4db8b11 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -28,7 +28,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 2.1.56
+Version: 2.1.57
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -785,6 +785,10 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Thu Oct 17 2013 Stephen Herr <sherr(a)redhat.com> 2.1.57-1
+- 1020497 - re-applying fix from 122418187 that got missed in the merge in
+ c821c7ee2
+
* Thu Oct 17 2013 Stephen Herr <sherr(a)redhat.com> 2.1.56-1
- 1020497 - provide a way to order kickstart scripts
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index ade0068..174f34e 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-2.1.56-1 java/
+2.1.57-1 java/
commit c7917c0b99b5cfb253f20efac99a5eb8512f0910
Author: Stephen Herr <sherr(a)redhat.com>
Date: Thu Oct 17 15:16:50 2013 -0400
1020497 - re-applying fix from 122418187 that got missed in the merge in c821c7ee2
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 75dfbfa..906e26e 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
@@ -613,7 +613,9 @@ public class KickstartFormatter {
else if (ksdata.getNonChrootPost() && !isPre && !kss.thisScriptIsChroot()) {
addLogBegin(retval, POST_LOG_NOCHROOT_FILE + "." + this.postLogPostfix,
kss.getInterpreter());
- retval.append(RHN_TRACE);
+ if (isBashInterpreter(kss.getInterpreter())) {
+ retval.append(RHN_TRACE);
+ }
}
else {
retval.append(NEWLINE);
10 years, 5 months