Trouble with berkshelf

I’m able to do berks install just fine, but if I then run berks upload -d mycompany-shinken I get an errror that the lock file is out of sync. I’ve blown away my ~/.berkshelf/.cache and ~/.berkshelf/cookbooks and even upgraded my ChefDK to 1.0.3 and still having the same issue. This is also throwing the same error on our Jenkins nodes so changes aren’t getting pushed to the Chef server. Running in debug mode I get the following:

[nclemons@hawke chef-devops (DEVOPS-716)]$ berks upload mycompany-shinken -d
I, [2016-12-12T13:15:38.813487 #44510]  INFO -- : Checking if lockfile is trusted
D, [2016-12-12T13:15:38.813629 #44510] DEBUG -- : Checking chef-client (>= 0.0.0)
D, [2016-12-12T13:15:38.825756 #44510] DEBUG -- :   Detected there is a cached cookbook
D, [2016-12-12T13:15:38.825843 #44510] DEBUG -- :   Checking transitive dependencies for chef-client (4.3.2)
D, [2016-12-12T13:15:38.825862 #44510] DEBUG -- :     Checking cron (>= 1.2.0)
D, [2016-12-12T13:15:38.825911 #44510] DEBUG -- :     Checking transitive dependencies for cron (1.7.6)
D, [2016-12-12T13:15:38.825924 #44510] DEBUG -- :       Already checked - skipping
D, [2016-12-12T13:15:38.825934 #44510] DEBUG -- :     Checking logrotate (>= 1.2.0)
D, [2016-12-12T13:15:38.825960 #44510] DEBUG -- :     Checking transitive dependencies for logrotate (1.9.2)
D, [2016-12-12T13:15:38.825971 #44510] DEBUG -- :       Already checked - skipping
D, [2016-12-12T13:15:38.825980 #44510] DEBUG -- :     Checking windows (~> 1.37)
D, [2016-12-12T13:15:38.826041 #44510] DEBUG -- :     Checking transitive dependencies for windows (1.38.4)
D, [2016-12-12T13:15:38.826053 #44510] DEBUG -- :       Already checked - skipping
D, [2016-12-12T13:15:38.826067 #44510] DEBUG -- : Checking chef-sugar (>= 0.0.0)
D, [2016-12-12T13:15:38.840457 #44510] DEBUG -- :   Detected there is a cached cookbook
D, [2016-12-12T13:15:38.840535 #44510] DEBUG -- :   Checking transitive dependencies for chef-sugar (3.3.0)
D, [2016-12-12T13:15:38.840556 #44510] DEBUG -- : Checking hostsfile (>= 0.0.0)
D, [2016-12-12T13:15:38.845178 #44510] DEBUG -- :   Detected there is a cached cookbook
D, [2016-12-12T13:15:38.845220 #44510] DEBUG -- :   Different location - cannot be trusted!
D, [2016-12-12T13:15:38.845276 #44510] DEBUG -- :     Dependency location: #<Berkshelf::GithubLocation:0x007f8410324cb8 @dependency=#<Berkshelf::Dependency: hostsfile (>= 0.0.0), locked_version: nil, groups: [:default], location: https://github.com/stormerider/hostsfile.git (at atomic)>, @options={:branch=>"atomic", :group=>[], :constraint=>nil, :git=>"https://github.com/stormerider/hostsfile.git"}, @uri="https://github.com/stormerider/hostsfile.git", @branch="atomic", @tag=nil, @ref=nil, @revision=nil, @rel=nil, @rev_parse="atomic">
D, [2016-12-12T13:15:38.845860 #44510] DEBUG -- :     Locked location:     #<Berkshelf::GitLocation:0x007f840e4ef1a8 @dependency=#<Berkshelf::Dependency: hostsfile (= 2.4.6), locked_version: #<Semverse::Version 2.4.6>, groups: [:default], location: git://github.com/stormerider/hostsfile.git (at atomic)>, @options={:git=>"git://github.com/stormerider/hostsfile.git", :revision=>"36f9e717cdfbc6e0f3d661bb24f8714070edba9a", :branch=>"atomic", :locked_version=>"2.4.6"}, @uri="git://github.com/stormerider/hostsfile.git", @branch="atomic", @tag=nil, @ref=nil, @revision="36f9e717cdfbc6e0f3d661bb24f8714070edba9a", @rel=nil, @rev_parse="atomic", @cached_cookbook=#<Berkshelf::CachedCookbook:0x007f8410284fb0 @cookbook_name="hostsfile", @path=#<Pathname:/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a>, @metadata=#<Ridley::Chef::Cookbook::Metadata:0x007f841028d3e0 @cookbook=nil, @name="hostsfile", @long_description="hostsfile LWRP\n==============\n[![Build Status](https://travis-ci.org/customink-webops/hostsfile.png?branch=master)](https://travis-ci.org/customink-webops/hostsfile)\n\n`hostsfile` provides an LWRP for managing your `/etc/hosts` (or Windows equivalent) file using Chef.\n\n\nRequirements\n------------\n- Chef 11 or higher\n- **Ruby 1.9.3 or higher**\n\n**Please stop opening Pull Requests to restore Ruby 1.8 support!** Any of the `1.x.y` series of this cookbook will work with Chef 10 and Ruby 1.8. You can use Chef's [Omnibus installer](http://www.chef.io/blog/2012/06/29/omnibus-chef-packaging/) to install Ruby 1.9+ and Seth Chisamore's [Vagrant Omnibus plugin](https://github.com/schisamo/vagrant-omnibus) to get Ruby 1.9+ on your Vagrant box.\n\n\nAttributes\n----------\n<table>\n  <tr>\n    <th>Attribute</th>\n    <th>Description</th>\n    <th>Example</th>\n    <th>Default</th>\n  </tr>\n  <tr>\n    <td>ip_address</td>\n    <td>(name attribute) the IP address for the entry</td>\n    <td><tt>1.2.3.4</tt></td>\n    <td></td>\n  </tr>\n  <tr>\n    <td>hostname</td>\n    <td>(required) the hostname associated with the entry</td>\n    <td><tt>example.com</tt></td>\n    <td></td>\n  </tr>\n  <tr>\n    <td>unique</td>\n    <td>remove any existing entries that have the same <tt>hostname</tt></td>\n    <td><tt>true</tt></td>\n    <td><tt>false</tt></td>\n  </tr>\n  <tr>\n    <td>aliases</td>\n    <td>array of aliases for the entry</td>\n    <td><tt>['www.example.com']</tt></td>\n    <td><tt>[]</tt></td>\n  </tr>\n  <tr>\n    <td>comment</td>\n    <td>a comment to append to the end of the entry</td>\n    <td><tt>'interal DNS server'</tt></td>\n    <td><tt>nil</tt></td>\n  </tr>\n  <tr>\n    <td>priority</td>\n    <td>the relative position of this entry</td>\n    <td><tt>20</tt></td>\n    <td>(varies, see **Priorities** section)</td>\n  </tr>\n</table>\n\n\nActions\n-------\n**Please note**: In `v0.1.2`, specifying a hostname or alias that existed in another automatically removed that hostname from the other entry before. In `v2.1.0`, the `unique` option was added to give the user case-by-case control of this behavior. For example, given an `/etc/hosts` file that contains:\n\n    1.2.3.4          example.com www.example.com\n\nwhen the Chef recipe below is converged:\n\n```ruby\nhostsfile_entry '2.3.4.5' do\n  hostname  'www.example.com'\n  unique    true\nend\n```\n\nthen the `/etc/hosts` file will look like this:\n\n    1.2.3.4          example.com\n    2.3.4.5          www.example.com\n\nNot specifying the `unique` parameter will result in duplicate hostsfile entries.\n\n#### `create`\nCreates a new hosts file entry. If an entry already exists, it will be overwritten by this one.\n\n```ruby\nhostsfile_entry '1.2.3.4' do\n  hostname  'example.com'\n  action    :create\nend\n```\n\nThis will create an entry like this:\n\n    1.2.3.4          example.com\n\n#### `create_if_missing`\nCreate a new hosts file entry, only if one does not already exist for the given IP address. If one exists, this does nothing.\n\n```ruby\nhostsfile_entry '1.2.3.4' do\n  hostname  'example.com'\n  action    :create_if_missing\nend\n```\n\n#### `append`\nAppend a hostname or alias to an existing record. If the given IP address doesn't already exist in the hostsfile, this method behaves the same as create. Otherwise, it will append the additional hostname and aliases to the existing entry.\n\n    1.2.3.4         example.com www.example.com # Created by Chef\n\n```ruby\nhostsfile_entry '1.2.3.4' do\n  hostname  'www2.example.com'\n  aliases   ['foo.com', 'foobar.com']\n  comment   'Append by Recipe X'\n  action    :append\nend\n```\n\nwould yield:\n\n    1.2.3.4         example.com www.example.com www2.example.com foo.com foobar.com # Created by Chef, Appended by Recipe X\n\n\n#### `update`\nUpdates the given hosts file entry. Does nothing if the entry does not exist.\n\n```ruby\nhostsfile_entry '1.2.3.4' do\n  hostname  'example.com'\n  comment   'Update by Chef'\n  action    :update\nend\n```\n\nThis will create an entry like this:\n\n    1.2.3.4           example # Updated by Chef\n\n#### `remove`\nRemoves an entry from the hosts file. Does nothing if the entry does not\nexist.\n\n```ruby\nhostsfile_entry '1.2.3.4' do\n  action    :remove\nend\n```\n\nThis will remove the entry for `1.2.3.4`.\n\n\nUsage\n-----\nIf you're using [Berkshelf](http://berkshelf.com/), just add `hostsfile` to your `Berksfile`:\n\n```ruby\ncookbook 'hostsfile'\n```\n\nOtherwise, install the cookbook from the community site:\n\n    knife cookbook site install hostsfile\n\nHave any other cookbooks *depend* on hostsfile by editing editing the `metadata.rb` for your cookbook.\n\n```ruby\n# metadata.rb\ndepends 'hostsfile'\n```\n\nNote that you can specify a custom path to your hosts file in the `['hostsfile']['path']` node attribute. Otherwise, it defaults to sensible paths depending on your OS.\n\n### Testing\nIf you are using [ChefSpec](https://github.com/sethvargo/chefspec) to unit test a cookbook that implements the `hostsfile_entry` LWRP, this cookbook packages customer matchers that you can use in your unit tests:\n\n- `append_hostsfile_entry`\n- `create_hostsfile_entry`\n- `create_hostsfile_entry_if_missing`\n- `remove_hostsfile_entry`\n- `update_hostsfile_entry`\n\nFor example:\n\n```ruby\nit 'creates a hostsfile entry for the DNS server' do\n  expect(chef_run).to create_hostsfile_entry('1.2.3.4')\n    .with_hostname('dns.example.com')\nend\n```\n\nPriority\n--------\nPriority is a relatively new addition to the cookbook. It gives you the ability to (somewhat) specify the relative order of entries. By default, the priority is calculated for you as follows:\n\n82. 127.0.0.1\n81. ::1\n80. 127.0.0.0/8\n60. IPV4\n20. IPV6\n00. default\n\nHowever, you can override it using the `priority` option.\n\n\nContributing\n------------\n1. Fork the project\n2. Create a feature branch corresponding to you change\n3. Commit and test thoroughly\n4. Create a Pull Request on github\n\n\nLicense & Authors\n-----------------\n- Author:: Seth Vargo (sethvargo@gmail.com)\n\n```text\nCopyright 2012-2013, Seth Vargo\nCopyright 2012, CustomInk, LLC\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n", @maintainer="Seth Vargo", @maintainer_email="sethvargo@gmail.com", @license="Apache 2.0", @description="Provides an LWRP for managing the /etc/hosts file", @platforms=#<Hashie::Mash>, @dependencies=#<Hashie::Mash>, @recommendations=#<Hashie::Mash>, @suggestions=#<Hashie::Mash>, @conflicting=#<Hashie::Mash>, @providing=#<Hashie::Mash>, @replacing=#<Hashie::Mash>, @attributes=#<Hashie::Mash>, @groupings=#<Hashie::Mash>, @recipes=#<Hashie::Mash>, @version=#<Semverse::Version 2.4.6>, @source_url="", @issues_url="", @privacy=false, @chef_versions=[], @ohai_versions=[], @gems=[]>, @frozen=false, @chefignore=nil, @files=["/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/attributes/default.rb", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/libraries/entry.rb", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/libraries/manipulator.rb", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/libraries/matchers.rb", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/resources/entry.rb", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/providers/entry.rb", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/.gitignore", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/.kitchen.yml", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/.travis.yml", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/Berksfile", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/CHANGELOG.md", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/Gemfile", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/LICENSE", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/metadata.rb", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/Rakefile", "/Users/nclemons/.berkshelf/cookbooks/hostsfile-36f9e717cdfbc6e0f3d661bb24f8714070edba9a/README.md"], @manifest=#<Hashie::Mash attributes=#<Hashie::Array [{:name=>"default.rb", :path=>"attributes/default.rb", :checksum=>"53441054a788eeb12d1e3910129006f4", :specificity=>"default"}]> definitions=#<Hashie::Array []> files=#<Hashie::Array []> libraries=#<Hashie::Array [{:name=>"entry.rb", :path=>"libraries/entry.rb", :checksum=>"e2743cfebdbf94da74b030733c33ff92", :specificity=>"default"}, {:name=>"manipulator.rb", :path=>"libraries/manipulator.rb", :checksum=>"70105b606ddcccbe812f5ab395f60974", :specificity=>"default"}, {:name=>"matchers.rb", :path=>"libraries/matchers.rb", :checksum=>"84d72789bc679b27608337dc431e8f52", :specificity=>"default"}]> providers=#<Hashie::Array [{:name=>"entry.rb", :path=>"providers/entry.rb", :checksum=>"3db4ae5f301ade38320d9abe87433e7b", :specificity=>"default"}]> recipes=#<Hashie::Array []> resources=#<Hashie::Array [{:name=>"entry.rb", :path=>"resources/entry.rb", :checksum=>"76cca1906da4698872c0f903d2c47d6b", :specificity=>"default"}]> root_files=#<Hashie::Array [{:name=>".gitignore", :path=>".gitignore", :checksum=>"0a5083c1056c65773104deda62dc56a6", :specificity=>"default"}, {:name=>".kitchen.yml", :path=>".kitchen.yml", :checksum=>"41d7ab230a9eaa0316a8ac4ed34a705b", :specificity=>"default"}, {:name=>".travis.yml", :path=>".travis.yml", :checksum=>"eabefa371669b92f09fc8351aa7171cc", :specificity=>"default"}, {:name=>"Berksfile", :path=>"Berksfile", :checksum=>"39dc4fdcd64f92d34c7552bf3220d091", :specificity=>"default"}, {:name=>"CHANGELOG.md", :path=>"CHANGELOG.md", :checksum=>"e5abcbcb03ac586bd2d0c7e08d537db6", :specificity=>"default"}, {:name=>"Gemfile", :path=>"Gemfile", :checksum=>"95d204c3c028befa31d2e63678852092", :specificity=>"default"}, {:name=>"LICENSE", :path=>"LICENSE", :checksum=>"908b129232884e3642157543b59e2e10", :specificity=>"default"}, {:name=>"metadata.rb", :path=>"metadata.rb", :checksum=>"76e244db754c4577d8c0a3f977bf86ba", :specificity=>"default"}, {:name=>"Rakefile", :path=>"Rakefile", :checksum=>"3ac233e5a0ea6675f22ea71eed257d4a", :specificity=>"default"}, {:name=>"README.md", :path=>"README.md", :checksum=>"62cc88f32d0717eb8a355f4aa89b72d1", :specificity=>"default"}]> templates=#<Hashie::Array []>>>>
The lockfile is out of sync! Run `berks install` to sync the lockfile.
        /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/berkshelf-5.2.0/lib/berkshelf/berksfile.rb:738:in `validate_lockfile_trusted!'
        /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/berkshelf-5.2.0/lib/berkshelf/berksfile.rb:590:in `upload'
        /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/berkshelf-5.2.0/lib/berkshelf/cli.rb:208:in `upload'
        /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
        /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/berkshelf-5.2.0/lib/berkshelf/cli.rb:52:in `dispatch'
        /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
        /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/berkshelf-5.2.0/lib/berkshelf/cli.rb:27:in `execute!'
        /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/berkshelf-5.2.0/bin/berks:5:in `<top (required)>'
        /usr/local/bin/berks:49:in `load'
        /usr/local/bin/berks:49:in `<main>'
[nclemons@hawke chef-devops (DEVOPS-716)]$

Try berks update to update the lock file with the current version (same as version installed by berks install)

So the reason that I want to avoid that is that we keep finding issues with newer versions that don’t play nicely with other versions, and berks update will move beyond the versions we currently have locked. I know this isn’t ideal, we’re working on identifying which versions aren’t compatible with each other so we can set proper dependencies in our cookbooks.

However, I did that briefly just so that I could see what got changed, using git diff. It seems like this was the main culprit:

index 5fd14ee..c2269c4 100644
--- a/Berksfile.lock
+++ b/Berksfile.lock
@@ -2,7 +2,7 @@ DEPENDENCIES
   chef-client
   chef-sugar
   hostsfile
-    git: git://github.com/stormerider/hostsfile.git
+    git: https://github.com/stormerider/hostsfile.git
     revision: 36f9e717cdfbc6e0f3d661bb24f8714070edba9a
     branch: atomic
   moxie```

Did something change with regards to how Berkshelf parses github resources? I have this defined in the Berksfile as:

```cookbook 'hostsfile',             github: 'stormerider/hostsfile', branch: 'atomic'```