A quick fix to the patch. I've missed an mkdir in the spec. Now it builds
correctly.
----- Original Message -----
From: "Matteo Sessa" <matteo.se...@dbmsrl.com>
To: spacewalk-devel@redhat.com
Sent: Tuesday, May 31, 2011 11:40:53 AM
Subject: Re: [Spacewalk-devel] Remote commands temporary file location
Hi,
Attached is a patch to implement solution #2 from my previous request.
/usr/share/rhn/actions/script.py now imports some libs for configuration file
access and reads "script_tmp_dir" parameter from rhncfg-client.conf, if unset
it will fallback to the previous behavior and use /tmp as usual.
@Mirek
I've made some changed to the rhncfg spec file too to create the new default
directory, do I need to update the changelog and/or the release number or is
something you will take care of? This is my first contribution here so forgive
my ignorance.
Regards.
/Matt
_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel
From 0ab0c0be421bc628e33b73af62c941f852556125 Mon Sep 17 00:00:00 2001
From: Matteo Sessa <matteo.se...@dbmsrl.com>
Date: Tue, 31 May 2011 12:25:08 +0200
Subject: [PATCH] temp script file customizable dedicated directory
---
client/tools/rhncfg/actions/script.py | 9 +++++++++
.../tools/rhncfg/config_client/rhncfg-client.conf | 3 +++
client/tools/rhncfg/rhncfg.spec | 2 ++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/client/tools/rhncfg/actions/script.py b/client/tools/rhncfg/actions/script.py
index 58afb28..957e7ab 100644
--- a/client/tools/rhncfg/actions/script.py
+++ b/client/tools/rhncfg/actions/script.py
@@ -31,6 +31,10 @@ except ImportError:
# this is ugly, hopefully it will be natively supported in up2date
from configfiles import _local_permission_check, _perm_error
+from config_common import local_config
+
+sys.path.append('/usr/share/rhn')
+from up2date_client import config
# this is a list of the methods that get exported by a module
@@ -76,6 +80,11 @@ def _create_script_file(script, uid=None, gid=None):
def run(action_id, params, cache_only=None):
+
+ cfg = config.initUp2dateConfig()
+ local_config.init('rhncfg-client', defaults=dict(cfg.items()))
+
+ tempfile.tempdir = local_config.get('script_tmp_dir')
if cache_only:
return (0, "no-ops for caching", {})
diff --git a/client/tools/rhncfg/config_client/rhncfg-client.conf b/client/tools/rhncfg/config_client/rhncfg-client.conf
index 1a1b93a..be2b3b6 100644
--- a/client/tools/rhncfg/config_client/rhncfg-client.conf
+++ b/client/tools/rhncfg/config_client/rhncfg-client.conf
@@ -7,6 +7,9 @@ systemid = /etc/sysconfig/rhn/systemid
# increase for debugging output
debug_level = 0
+# Default directory for remote command temporary script file.
+# If not set it will default to None and it will fallback to python's default tempdir search algorithm
+script_tmp_dir = /var/spool/rhn
# don't change this... used in substitutions below.
# if you get rid of the '%(server_handler)s' bits below,
diff --git a/client/tools/rhncfg/rhncfg.spec b/client/tools/rhncfg/rhncfg.spec
index 20c3e9b..88120e7 100644
--- a/client/tools/rhncfg/rhncfg.spec
+++ b/client/tools/rhncfg/rhncfg.spec
@@ -67,6 +67,7 @@ install -d $RPM_BUILD_ROOT/%{rhnroot}
make -f Makefile.rhncfg install PREFIX=$RPM_BUILD_ROOT ROOT=%{rhnroot} \
MANDIR=%{_mandir}
mkdir -p $RPM_BUILD_ROOT/%{_sharedstatedir}/rhncfg/backups
+mkdir -p $RPM_BUILD_ROOT/%{_localstatedir}/spool/rhn
%clean
rm -rf $RPM_BUILD_ROOT
@@ -77,6 +78,7 @@ rm -rf $RPM_BUILD_ROOT
%dir %{_sharedstatedir}
%endif
%dir %{_sharedstatedir}/rhncfg
+%dir %{_localstatedir}/spool/rhn
%{rhnroot}/config_common
%{_sharedstatedir}/rhncfg/backups
%doc LICENSE PYTHON-LICENSES.txt
--
1.7.4.1
_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel