[docker-registry/el6] Docker-registry does not currently support moving the config file, RHBZ#1038874

Marek Goldmann goldmann at fedoraproject.org
Mon Dec 9 08:29:12 UTC 2013


commit 4fec47de88f62a183ce667b5640f4d3c54f37648
Author: Marek Goldmann <marek.goldmann at gmail.com>
Date:   Fri Dec 6 16:14:35 2013 +0100

    Docker-registry does not currently support moving the config file, RHBZ#1038874

 ...-for-config-files-outside-of-the-source-d.patch |   28 ++++++++++++++++++++
 docker-registry.spec                               |   10 ++++++-
 docker-registry.sysconfig                          |    2 +-
 docker-registry.sysvinit                           |    2 +
 4 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/Add-support-for-config-files-outside-of-the-source-d.patch b/Add-support-for-config-files-outside-of-the-source-d.patch
new file mode 100644
index 0000000..acf4c3b
--- /dev/null
+++ b/Add-support-for-config-files-outside-of-the-source-d.patch
@@ -0,0 +1,28 @@
+From 5ae34aecc5dae8fb0a7f7732d11ddbfcc16bc804 Mon Sep 17 00:00:00 2001
+From: Marek Goldmann <marek.goldmann at gmail.com>
+Date: Fri, 6 Dec 2013 15:37:25 +0100
+Subject: [PATCH] Add support for config files outside of the source directory
+
+---
+ lib/config.py | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/lib/config.py b/lib/config.py
+index 781e353..4c951e5 100644
+--- a/lib/config.py
++++ b/lib/config.py
+@@ -48,8 +48,9 @@ def load():
+     if _config is not None:
+         return _config
+     data = None
+-    config_file = os.environ.get('DOCKER_REGISTRY_CONFIG', 'config.yml')
+-    config_path = os.path.join(os.path.dirname(__file__), '..', config_file)
++    config_path = os.environ.get('DOCKER_REGISTRY_CONFIG', 'config.yml')
++    if not os.path.isabs(config_path):
++        config_path = os.path.join(os.path.dirname(__file__), '..', config_path)
+     with open(config_path) as f:
+         data = yaml.load(f)
+     config = data.get('common', {})
+-- 
+1.8.4.2
+
diff --git a/docker-registry.spec b/docker-registry.spec
index 589fce3..19e9ac4 100644
--- a/docker-registry.spec
+++ b/docker-registry.spec
@@ -7,7 +7,7 @@
 Summary:        Registry server for Docker
 Name:           docker-registry
 Version:        0.6.0
-Release:        3%{?dist}
+Release:        4%{?dist}
 License:        ASL 2.0
 URL:            https://github.com/dotcloud/docker-registry
 Source:         https://github.com/dotcloud/docker-registry/archive/%{version}.tar.gz
@@ -18,6 +18,9 @@ Source3:        docker-registry.sysvinit
 # Support for older Redis Python binding in EPEL
 Patch0:         Support-for-older-Redis-Python-binding.patch
 
+# Support for configuration files lcoated outside of the source directory
+Patch1:         Add-support-for-config-files-outside-of-the-source-d.patch
+
 BuildRequires:    python2-devel
 
 %if %{with systemd}
@@ -60,6 +63,8 @@ rm -rf contrib/golang_impl
 %patch0 -p1
 %endif
 
+%patch1 -p1
+
 %install
 install -d %{buildroot}%{_bindir}
 install -d %{buildroot}%{_sysconfdir}/sysconfig
@@ -144,6 +149,9 @@ fi
 %endif
 
 %changelog
+* Fri Dec 06 2013 Marek Goldmann <mgoldman at redhat.com> - 0.6.0-4
+- Docker-registry does not currently support moving the config file, RHBZ#1038874
+
 * Mon Dec 02 2013 Marek Goldmann <mgoldman at redhat.com> - 0.6.0-3
 - EPEL support
 - Comments in the sysconfig/docker-registry file
diff --git a/docker-registry.sysconfig b/docker-registry.sysconfig
index 93c8755..3f9374c 100644
--- a/docker-registry.sysconfig
+++ b/docker-registry.sysconfig
@@ -1,5 +1,5 @@
 # The Docker registry configuration file
-DOCKER_REGISTRY_CONFIG=/etc/docker-registry.yml
+# DOCKER_REGISTRY_CONFIG=/etc/docker-registry.yml
 
 # The configuration to use from DOCKER_REGISTRY_CONFIG file
 SETTINGS_FLAVOR=local
diff --git a/docker-registry.sysvinit b/docker-registry.sysvinit
index 7a206b3..04b1c4a 100644
--- a/docker-registry.sysvinit
+++ b/docker-registry.sysvinit
@@ -30,6 +30,8 @@ logfile="/var/log/$prog"
 
 [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
 
+export DOCKER_REGISTRY_CONFIG=${DOCKER_REGISTRY_CONFIG:-"/etc/docker-registry.yml"}
+
 start() {
     [ -x $exec ] || exit 5
 


More information about the scm-commits mailing list