Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error executing action login on resource docker_registry #114

Closed
psviderski opened this issue Apr 5, 2014 · 3 comments
Closed

Error executing action login on resource docker_registry #114

psviderski opened this issue Apr 5, 2014 · 3 comments

Comments

@psviderski
Copy link
Contributor

I use the latest version of chef-docker cookbook from the master branch. When I try to login to a private repository the following error is occurred:

================================================================================
Error executing action `login` on resource 'docker_registry[https://registry.xxx.com]'
================================================================================


Errno::ENOENT
-------------
No such file or directory - /root/.dockercfg


Cookbook Trace:
---------------
/tmp/vagrant-chef-1/chef-solo-2/cookbooks/docker/libraries/helpers.rb:59:in `read'
/tmp/vagrant-chef-1/chef-solo-2/cookbooks/docker/libraries/helpers.rb:59:in `dockercfg_parse'
/tmp/vagrant-chef-1/chef-solo-2/cookbooks/docker/providers/registry.rb:6:in `load_current_resource'


Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/test/recipes/default.rb

  1: docker_registry 'https://registry.xxx.com' do
  2:   username 'xxx'
  3:   password 'yyy'
  4: end
  5:

Do I have to manually create the missing /root/.dockercfg file?
Btw, when I create it with the content:

{}

it still doesn't solve the problem.
It seems that logged_in? always returns true even if we are not logged in. Because of this, the login function isn't called.

@bflad bflad closed this as completed in 5233b43 Apr 13, 2014
@bflad
Copy link
Contributor

bflad commented Apr 13, 2014

Added two simple fixes, which you can either use from master or 0.34.0 which I'll be releasing momentarily:

  • rescue when .dockercfg doesn't exist and return nil
  • Explicitly set TrueClass or FalseClass in logged_in? method

If you still have trouble, please let me know. Thanks for the detailed report.

bflad added a commit that referenced this issue Apr 13, 2014
@psviderski
Copy link
Contributor Author

It seems you didn't fix the issue with logged_in? method. Why are you checking the .server attribute in order to determine whether we are logged in?

attribute :server, :name_attribute => true

.server is a name attribute, so it seems to be assigned on a fresh @current_resource.
I would rather check a .username or a .password attribute.

@bflad
Copy link
Contributor

bflad commented Apr 14, 2014

Hmmm good point... I just figured it wouldn't exist in @current_resource unless this ran: https://github.com/bflad/chef-docker/blob/master/providers/registry.rb#L9

I'll move it to checking username instead.

@bflad bflad reopened this Apr 14, 2014
@bflad bflad closed this as completed in 0f6473f Apr 16, 2014
bflad added a commit that referenced this issue Apr 16, 2014
Fix docker_registry login handling, fixes #114
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants