# Edit old Cookbook versions

**URL:** <https://discourse.chef.io/t/edit-old-cookbook-versions/4730>\
**Category:** Chef Infra (archive)\
**Created:** [November 22, 2013, 4:32pm UTC](https://discourse.chef.io/t/edit-old-cookbook-versions/4730 "2013-11-22T16:32:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Feldhusen](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@Eric\_Feldhusen](https://discourse.chef.io/u/Eric_Feldhusen)\
**Post date:** [November 22, 2013, 4:32pm UTC](https://discourse.chef.io/t/edit-old-cookbook-versions/4730/1 "2013-11-22T16:32:17Z")

</div>

I took over an existing Chef server and it has several cookbooks with  
multiple versions, with various environments locked to several of those  
versions.

I now need to edit multiple cookbook versions to fix hardcoded items due to  
changes in our environment and I was wondering what the best way to handle  
making those changes would be?

I was thinking I could create various git branches on my workstation and  
knife download the specific version, change the hardcode item(s), and force  
a cookbook upload.

It’s not perfect, but it helps until I can move various  
servers/environments to latest cookbook versions.

Eric Feldhusen

---

<div class="post-metadata">

**Author:** ![Eric\_Feldhusen](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@Eric\_Feldhusen](https://discourse.chef.io/u/Eric_Feldhusen)\
**Post date:** [November 22, 2013, 5:41pm UTC](https://discourse.chef.io/t/edit-old-cookbook-versions/4730/2 "2013-11-22T17:41:44Z")

</div>

Or because I literally just need to change an IP address in a couple of  
recipes for now, could I just go to the  
/var/opt/chef-server/bookshelf/data/bookshelf  
directory and quick edit the file or will that really break stuff?

Eric

On Fri, Nov 22, 2013 at 11:32 AM, Eric Feldhusen \<[efeldhusen.lists@gmail.com](mailto:efeldhusen.lists@gmail.com)

> wrote:

> I took over an existing Chef server and it has several cookbooks with  
> multiple versions, with various environments locked to several of those  
> versions.
> 
> I now need to edit multiple cookbook versions to fix hardcoded items due  
> to changes in our environment and I was wondering what the best way to  
> handle making those changes would be?
> 
> I was thinking I could create various git branches on my workstation and  
> knife download the specific version, change the hardcode item(s), and force  
> a cookbook upload.
> 
> It's not perfect, but it helps until I can move various  
> servers/environments to latest cookbook versions.
> 
> Eric Feldhusen

---

<div class="post-metadata">

**Author:** ![Eric\_Feldhusen](https://avatars.discourse-cdn.com/v4/letter/e/57b2e6/32.png) [@Eric\_Feldhusen](https://discourse.chef.io/u/Eric_Feldhusen)\
**Post date:** [November 22, 2013, 5:53pm UTC](https://discourse.chef.io/t/edit-old-cookbook-versions/4730/3 "2013-11-22T17:53:29Z")

</div>

No, I see that's not the way to go.

Eric

On Fri, Nov 22, 2013 at 12:41 PM, Eric Feldhusen \<[efeldhusen.lists@gmail.com](mailto:efeldhusen.lists@gmail.com)

> wrote:

> Or because I literally just need to change an IP address in a couple of  
> recipes for now, could I just go to the /var/opt/chef-server/bookshelf/data/bookshelf  
> directory and quick edit the file or will that really break stuff?
> 
> Eric
> 
> On Fri, Nov 22, 2013 at 11:32 AM, Eric Feldhusen \<  
> [efeldhusen.lists@gmail.com](mailto:efeldhusen.lists@gmail.com)\> wrote:
> 
> > I took over an existing Chef server and it has several cookbooks with  
> > multiple versions, with various environments locked to several of those  
> > versions.
> > 
> > I now need to edit multiple cookbook versions to fix hardcoded items due  
> > to changes in our environment and I was wondering what the best way to  
> > handle making those changes would be?
> > 
> > I was thinking I could create various git branches on my workstation and  
> > knife download the specific version, change the hardcode item(s), and force  
> > a cookbook upload.
> > 
> > It's not perfect, but it helps until I can move various  
> > servers/environments to latest cookbook versions.
> > 
> > Eric Feldhusen

---

<div class="post-metadata">

**Author:** ![jdunn](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jdunn/32/1800_2.png) [@jdunn](https://discourse.chef.io/u/jdunn)\
**Post date:** [November 23, 2013, 5:32pm UTC](https://discourse.chef.io/t/edit-old-cookbook-versions/4730/4 "2013-11-23T17:32:17Z")

</div>

On Fri, Nov 22, 2013 at 11:32 AM, Eric Feldhusen  
[efeldhusen.lists@gmail.com](mailto:efeldhusen.lists@gmail.com) wrote:

> I took over an existing Chef server and it has several cookbooks with  
> multiple versions, with various environments locked to several of those  
> versions.
> 
> I now need to edit multiple cookbook versions to fix hardcoded items due to  
> changes in our environment and I was wondering what the best way to handle  
> making those changes would be?
> 
> I was thinking I could create various git branches on my workstation and  
> knife download the specific version, change the hardcode item(s), and force  
> a cookbook upload.
> 
> It's not perfect, but it helps until I can move various servers/environments  
> to latest cookbook versions.

It sounds like you already understand the following, but just for  
others on the list: It's not best practice to upload the same version  
of something after you change the code underneath (you don't release  
Microsoft Windows 2003 a hundred times for all the bug fixes, you make  
a service pack).

Nevertheless, you can overwrite old versions of cookbooks on the Chef server:

1. knife cookbook download my-cookbook X.Y.Z
2. tar zxvf my-cookbook-X.Y.Z.tar.gz -C cookbooks
3. 
4. knife cookbook upload my-cookbook # might need to --force if X.Y.Z  
is frozen on the server

- Julian

--  
[Julian C. Dunn [jdunn@aquezada.com](mailto:jdunn@aquezada.com) \* Sorry, I'm ]  
[WWW: [Julian Dunn's Blog - Commentary on media, technology, and everything in between.](http://www.aquezada.com/staff/julian) \* only Web 1.0 ]  
[gopher://sdf.org/1/users/keymaker/ \* compliant!]  
[PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9]
