Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

config.standalone is not loaded as True, but as 'True' causing issues #431

Closed
petarmaric opened this issue Jun 17, 2014 · 10 comments
Closed

Comments

@petarmaric
Copy link

$ sudo docker run -ti -e STANDALONE=True -e SEARCH_BACKEND=sqlalchemy registry /bin/bash
root@6aa5299af075:/# cd docker-registry/
root@6aa5299af075:/docker-registry# python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from docker_registry.lib.config import *
>>> load()
{'sqlalchemy_index_database': 'sqlite:////tmp/docker-registry.db', 'standalone': 'True', 'loglevel': 'debug', 'storage': 'local', 'search_backend': 'sqlalchemy', 'email_exceptions': {'smtp_secure': 'false', 'to_addr': 'noise+dockerregistry@localdomain.local', 'smtp_port': '25', 'from_addr': 'docker-registry@localdomain.local'}, 'flavor': 'dev', 'storage_path': '/tmp/registry'}
>>>

Please observe that config.load returned 'standalone': 'True'. Looking at a8016be and other files you can see something is True test are used extensively, however:

>>> 'True' is True
False
>>>  'true' is True
False
>>>  'TRUE' is True
False
>>> '1' is True
False

Also when inspecting the HTTP headers:

$ sudo docker run -d -e STANDALONE=True -e SEARCH_BACKEND=sqlalchemy -p 5000:5000 registry
$ curl -I http://localhost:5000/_ping
HTTP/1.1 200 OK
Server: gunicorn/18.0
Date: Tue, 17 Jun 2014 11:17:39 GMT
Connection: keep-alive
X-Docker-Registry-Standalone: False
Expires: -1
Content-Type: application/json
Pragma: no-cache
Cache-Control: no-cache
Content-Length: 4
X-Docker-Registry-Version: 0.7.2
X-Docker-Registry-Config: dev

We can see X-Docker-Registry-Standalone has been set to False, seemingly ignoring the STANDALONE env variable.

The solution is to properly convert a string into a boolean, as per http://stackoverflow.com/questions/715417/converting-from-a-string-to-boolean-in-python

@wking
Copy link
Contributor

wking commented Jun 17, 2014

On Tue, Jun 17, 2014 at 04:35:51AM -0700, petarmaric wrote:

The solution is to properly convert a string into a boolean, as per
http://stackoverflow.com/questions/715417/converting-from-a-string-to-boolean-in-python

Or converting to a subclass of ConfigParser (a subclass so we can add
environment-variable expansion) 1, after which we could use getboolean
2.

@petarmaric
Copy link
Author

I see that you've created 34dea1e which merely migitates this issue somewhat. It would be nice if the developers would reference the relevant issues in ther commit messages.

@shin-
Copy link
Contributor

shin- commented Jun 18, 2014

This is just intended as a short term fix, we agree that there's a bigger issue at hand, please bear with us.

@mdub mdub mentioned this issue Jun 20, 2014
@petarmaric
Copy link
Author

Bear with us

@dmp42
Copy link
Contributor

dmp42 commented Jun 20, 2014

Working on it :-)

@petarmaric
Copy link
Author

So there's now a "phantom" 0.7.3 release with a quick-fix to this issue. Why so secret?

@dmp42
Copy link
Contributor

dmp42 commented Jun 20, 2014

Phantom? Secret?

Here's the tag: /~https://github.com/dotcloud/docker-registry/tree/0.7.3

Here's the CHANGELOG: /~https://github.com/dotcloud/docker-registry/blob/0.7.3/CHANGELOG.md

Here's the PR with the change for it : #436

As stated earlier, this is a quick fix to alleviate the problem described here: #432 - which clearly states that 0.7.3 has been released.

Now, about this ticket, as I said, I'm working on it for a better fix, and it will be closed when that work will be ready.

Hope that addresses your concerns :-)

@petarmaric
Copy link
Author

Yes, I've seen all of those and thank you for the rapid quick-fix. I was just wondering why aren't the related issues referenced in commits (As in FIXES #123, REFS #135 #154: Commit message here), as it would make issue tracking a lot easier (not having to review commits on a daily basis).

No quarrels with your effort and results, only the issue tracking process.

@dmp42
Copy link
Contributor

dmp42 commented Jun 20, 2014

I was just wondering why aren't the related issues referenced in commits (As in FIXES # 123, REFS # 135 # 154: Commit message here), as it would make issue tracking a lot easier (not having to review commits on a daily basis).

I understand your frustration.

A start would be to update CONTRIBUTE.md to clearly state said better commit guidelines.

@dmp42 dmp42 mentioned this issue Jun 23, 2014
@dmp42
Copy link
Contributor

dmp42 commented Aug 15, 2014

That was fixed by #444

@dmp42 dmp42 closed this as completed Aug 15, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants