[scsi-target-utils/f17] improve conf.d/ handling (#643302)
Pádraig Brady
pbrady at fedoraproject.org
Thu Sep 27 16:42:09 UTC 2012
commit c7973ad447955ba06a310f8b143f6dbb8121e74b
Author: Pádraig Brady <P at draigBrady.com>
Date: Thu Sep 27 16:51:56 2012 +0100
improve conf.d/ handling (#643302)
- Allow config files to include (all files from) directories
- Support conf.d/ on upgrade even with modified targets.conf
(cherry picked from commit 1f9f00422d2b48834b87a40d137fe4b4cb79b319)
scsi-target-utils-include-dirs.patch | 25 +++++++++++++++++++++++++
scsi-target-utils.spec | 11 ++++++++++-
sysconfig.tgtd | 2 +-
targets.conf | 3 ---
tgtd.conf | 5 +++++
5 files changed, 41 insertions(+), 5 deletions(-)
---
diff --git a/scsi-target-utils-include-dirs.patch b/scsi-target-utils-include-dirs.patch
new file mode 100644
index 0000000..4c653ed
--- /dev/null
+++ b/scsi-target-utils-include-dirs.patch
@@ -0,0 +1,25 @@
+enable IncludeDirectories so that config files
+within conf.d can include arbitrary config files
+(IncludeGlob is only supported for a single level
+in perl's Config-general currently).
+
+--- a/scripts/tgt-admin 2012-09-26 23:15:24.544264517 +0100
++++ b/scripts/tgt-admin 2012-09-26 23:07:10.489057377 +0100
+@@ -162,7 +162,7 @@
+ # Check if alternative configuration file exists
+ if (-e "$alternate_conf") {
+ execute("# Using $alternate_conf as configuration file\n");
+- %conf = ParseConfig(-ConfigFile => "$alternate_conf", -UseApacheInclude => 1, -IncludeGlob => 1, -MergeDuplicateBlocks => 1);
++ %conf = ParseConfig(-ConfigFile => "$alternate_conf", -UseApacheInclude => 1, -IncludeDirectories => 1, -IncludeGlob => 1, -MergeDuplicateBlocks => 1);
+ }
+ else {
+ die("Config file $alternate_conf not found. Exiting...\n");
+@@ -170,7 +170,7 @@
+ } else {
+ # Parse the config file with Config::General
+ if (-e "$configfile") {
+- %conf = ParseConfig(-ConfigFile => "$configfile", -UseApacheInclude => 1, -IncludeGlob => 1, -MergeDuplicateBlocks => 1);
++ %conf = ParseConfig(-ConfigFile => "$configfile", -UseApacheInclude => 1, -IncludeDirectories => 1, -IncludeGlob => 1, -MergeDuplicateBlocks => 1);
+ } else {
+ die("Config file $configfile not found. Exiting...\n");
+ }
diff --git a/scsi-target-utils.spec b/scsi-target-utils.spec
index 51a7c44..59321f0 100644
--- a/scsi-target-utils.spec
+++ b/scsi-target-utils.spec
@@ -4,7 +4,7 @@
Name: scsi-target-utils
Version: 1.0.24
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: The SCSI target daemon and utility programs
Group: System Environment/Daemons
@@ -15,9 +15,11 @@ Source1: tgtd.service
Source2: sysconfig.tgtd
Source3: targets.conf
Source4: sample.conf
+Source5: tgtd.conf
Patch0: scsi-target-utils-redhatify-docs.patch
Patch1: scsi-target-utils-remove-xsltproc-check.patch
Patch2: scsi-target-utils-dynamic-link-iser.patch
+Patch3: scsi-target-utils-include-dirs.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -50,6 +52,7 @@ Extensions for RDMA (ISER) to scsi-target-utils.
%patch0 -p1
%patch1 -p1
%patch2 -p1
+%patch3 -p1
%build
%{__sed} -i -e 's|-g -O2 -Wall|%{optflags}|' Makefile
@@ -76,6 +79,7 @@ Extensions for RDMA (ISER) to scsi-target-utils.
%{__install} -p -m 0600 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/tgtd
%{__install} -p -m 0600 %{SOURCE3} %{buildroot}%{_sysconfdir}/tgt
%{__install} -p -m 0600 %{SOURCE4} %{buildroot}%{_sysconfdir}/tgt/conf.d
+%{__install} -p -m 0600 %{SOURCE5} %{buildroot}%{_sysconfdir}/tgt
pushd usr
%{__make} install %{?with_rdma:ISCSI_RDMA=1} DESTDIR=%{buildroot} sbindir=%{_sbindir} libdir=%{_libdir}/tgt
@@ -115,6 +119,7 @@ fi
%{_unitdir}/tgtd.service
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/tgtd
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/tgt/targets.conf
+%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/tgt/tgtd.conf
%attr(0600,root,root) %config(noreplace) %{_sysconfdir}/tgt/conf.d/sample.conf
%if 0%{?with_rdma}
@@ -124,6 +129,10 @@ fi
%changelog
+* Thu Sep 27 2012 Pádraig Brady <P at draigBrady.com> - 1.0.24-5
+- Allow config files to include (all files from) directories
+- Support conf.d/ on upgrade even with modified targets.conf
+
* Fri Sep 21 2012 Andy Grover <agrover at redhat.com> - 1.0.24-4
- Add /etc/tgt/conf.d directory, and move samples from targets.conf
into conf.d/samples.conf. See #643302, thanks ssato at redhat.com.
diff --git a/sysconfig.tgtd b/sysconfig.tgtd
index 64df6a3..012dd16 100644
--- a/sysconfig.tgtd
+++ b/sysconfig.tgtd
@@ -2,4 +2,4 @@
TGTD_OPTS=""
# configuration file
-TGTD_CONFIG=/etc/tgt/targets.conf
+TGTD_CONFIG=/etc/tgt/tgtd.conf
diff --git a/targets.conf b/targets.conf
index bb1995e..41e8ddc 100644
--- a/targets.conf
+++ b/targets.conf
@@ -2,9 +2,6 @@
#
# The "#" symbol disables the processing of a line.
-# This one includes other config files:
-include /etc/tgt/conf.d/*.conf
-
# Set the driver. If not specified, defaults to "iscsi".
default-driver iscsi
diff --git a/tgtd.conf b/tgtd.conf
new file mode 100644
index 0000000..6c339d1
--- /dev/null
+++ b/tgtd.conf
@@ -0,0 +1,5 @@
+# The default config file
+include /etc/tgt/targets.conf
+
+# Config files from other packages etc.
+include /etc/tgt/conf.d/*.conf
More information about the scm-commits
mailing list