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

--include-dependencies option not working properly? #113

Open
jpb opened this issue Mar 26, 2014 · 3 comments
Open

--include-dependencies option not working properly? #113

jpb opened this issue Mar 26, 2014 · 3 comments

Comments

@jpb
Copy link

jpb commented Mar 26, 2014

I'm trying to setup knife-spork in a chef-repo with my own cookbooks under site-cookbooks/ and third party cookbooks managed by librarian installed into cookbooks/. There are currently no cookbooks on my chef server. When I run kitchen spork upload lp-reports --include-dependencies, I get an error:

ERROR: lp-reports depends on apt (>= 0.0.0), which is not currently being uploaded and cannot be found on the server!

Am I misunderstanding the purpose of --include-dependencies? It seems to me that with that option set, a cookbook's dependencies should get uploaded with it - but that is not the case.

When the --include-dependenies option is present, it appears that @cookbooks includes all dependencies in an order that would satisfy check_dependencies, but only the cookbook passed to knife spork upload is actually uploaded. Without the option present, @cookbooks only contains the cookbooks passed to the command.

If this is indeed a bug in how --include-dependencies should work, then this should allow uploads of all @cookbooks when --include-dependencies is set. If so, then that is not the end of the dependency woes - in my example apt is included as a dependency more than once and if I run knife spork upload lp-reports apt --include-dependencies, it throws an error when it tries to upload apt a second time, after uploading and freezing it already in the same run.

Here is the metadata for my cookbooks that are involved:

# site-cookbooks/lp-reports/metadata.rb
name             'lp-reports'
...
depends          'apt'
depends          'ruby_build'
depends          'rbenv'
depends          'ub-base'
depends          'ub-passenger'

# site-cookbooks/ub-base/metadata.rb
name             'ub-base'
...
depends          'apt'

# site-cookbooks/ub-passenger/metadata.rb
name             'ub-passenger'
...
depends          'apt'

I'm happy to dig in and fix this, given that I understand --include-dependencies correctly.

@jonlives
Copy link
Owner

@jpb thanks for the report! I think you may be correct here and --include-dependencies is not working as intended (we don't use it so I hadn't noticed this).

From a quick glance, the code should support the uploading of all dependencies, but I suspect the check you highlighted on "if name_args.include?(cookbook.name.to_s)" is resulting in only the named cookbook actually being uploaded.

If you're OK to have a crack at this I'd be happy to accept a PR - if you get stuck lemme know and I'll try and work on it. Adding this to the next release milestone too.

@jonlives jonlives added this to the version 1.3.3 milestone Mar 26, 2014
@jonlives
Copy link
Owner

@jpb did you ever get a chance to have a poke at this? Hoping to fix this for the upcoming release and no point in me redoing it if you already did :p

@jonlives jonlives removed this from the version 1.3.3 milestone May 23, 2014
@jpb
Copy link
Author

jpb commented May 28, 2014

@jonlives no, I haven't taken a look yet

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