Edit old Cookbook versions


#1

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


#2

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

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


#3

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

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> 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


#4

On Fri, Nov 22, 2013 at 11:32 AM, Eric Feldhusen
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. 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 * Sorry, I’m ]
[ WWW: 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 ]