Updating a template

So, I went thru the rigors of trying to modify a template file this morning.

I made a change to a template file. dollowed by a "knife cookbook upload
[cookbooknamehere]

chef-client on the node,

the old template was taking effect

so i then deleted the cache of all cookbooks ont he node,

same problem,

i getn deleted the cache on the node, and the cookbook (ALL VERSIONS) from
the chef server, Changed the version of the cookbook, then uploaded again,

same problem

infact When I did knife cookbook download, it downloaded the cookbook with
the told template file.

My solution, (once I had decided that punching my screen wouldnt actually
hurt the chef server), was to rename my template file, and change the name
in my template resource, and upload.

What I didnt do, was effectively delete what ever kinda cache there is on
the chef server, i don’t know if its even possible.

Please tell me i’m retarded, and that i just need to add a
"–stop-the-pain" at the end of the cookbook upload command…

On Wednesday, March 26, 2014 at 11:27 AM, Kenneth Barry wrote:

So, I went thru the rigors of trying to modify a template file this morning.

I made a change to a template file. dollowed by a "knife cookbook upload [cookbooknamehere]

chef-client on the node,

the old template was taking effect

so i then deleted the cache of all cookbooks ont he node,

same problem,

i getn deleted the cache on the node, and the cookbook (ALL VERSIONS) from the chef server, Changed the version of the cookbook, then uploaded again,

same problem

infact When I did knife cookbook download, it downloaded the cookbook with the told template file.

My solution, (once I had decided that punching my screen wouldnt actually hurt the chef server), was to rename my template file, and change the name in my template resource, and upload.

What I didnt do, was effectively delete what ever kinda cache there is on the chef server, i don't know if its even possible.

Please tell me i'm retarded, and that i just need to add a "--stop-the-pain" at the end of the cookbook upload command.......
There’s a few places something could have gone wrong. First of all, did you change the cookbook’s version? If so, you should check which version was downloaded to the client. If chef-client is downloading a different version than you expected, it could be caused by dependency constraints in your environment or in other cookbooks, or perhaps a bug in the dependency solver.

If you did not modify the cookbook’s version, then there’s a few possibilities. Did you get a warning about cookbook overlays when you uploaded? That would indicate that you have another copy of the cookbook somewhere in your cookbook_path, and a combined copy of the cookbook is getting generated by knife when uploading. Otherwise, it could be a bug in knife or the server. I would need to look at the output of knife cookbook upload -VV and a subsequent knife cookbook show COOKBOOK VERSION to figure out what’s going on.

--
Daniel DeLeo

"First of all, did you change the cookbook's version?"
Yes, I changed the version of the cookbook

" If so, you should check which version was downloaded to the client. "
i don't know how to see what version was downloaded to the client (do you
mean Node?), but what I do know if when i download from the chef server
"knife cookbook download [name]" I get the old template file (containing
the old content)

"If chef-client is downloading a different version than you expected, it
could be caused by "

"dependency constraints in your environment or in other cookbooks,"
we are not using any constraints in our environments. period.

On Wed, Mar 26, 2014 at 11:44 AM, Daniel DeLeo dan@kallistec.com wrote:

On Wednesday, March 26, 2014 at 11:27 AM, Kenneth Barry wrote:

So, I went thru the rigors of trying to modify a template file this
morning.

I made a change to a template file. dollowed by a "knife cookbook upload
[cookbooknamehere]

chef-client on the node,

the old template was taking effect

so i then deleted the cache of all cookbooks ont he node,

same problem,

i getn deleted the cache on the node, and the cookbook (ALL VERSIONS)
from the chef server, Changed the version of the cookbook, then uploaded
again,

same problem

infact When I did knife cookbook download, it downloaded the cookbook
with the told template file.

My solution, (once I had decided that punching my screen wouldnt
actually hurt the chef server), was to rename my template file, and change
the name in my template resource, and upload.

What I didnt do, was effectively delete what ever kinda cache there is
on the chef server, i don't know if its even possible.

Please tell me i'm retarded, and that i just need to add a
"--stop-the-pain" at the end of the cookbook upload command.......
There's a few places something could have gone wrong. First of all, did
you change the cookbook's version? If so, you should check which version
was downloaded to the client. If chef-client is downloading a different
version than you expected, it could be caused by dependency constraints in
your environment or in other cookbooks, or perhaps a bug in the dependency
solver.

If you did not modify the cookbook's version, then there's a few
possibilities. Did you get a warning about cookbook overlays when you
uploaded? That would indicate that you have another copy of the cookbook
somewhere in your cookbook_path, and a combined copy of the cookbook is
getting generated by knife when uploading. Otherwise, it could be a bug in
knife or the server. I would need to look at the output of knife cookbook upload -VV and a subsequent knife cookbook show COOKBOOK VERSION to
figure out what's going on.

--
Daniel DeLeo

On Wednesday, March 26, 2014 at 12:56 PM, Kenneth Barry wrote:

"First of all, did you change the cookbook’s version?"
Yes, I changed the version of the cookbook

" If so, you should check which version was downloaded to the client. "
i don't know how to see what version was downloaded to the client (do you mean Node?), but what I do know if when i download from the chef server "knife cookbook download [name]" I get the old template file (containing the old content)

The most straightforward way to see what version is on a node is to look at the metadata file in the cache directory.

Also, have you uploaded with the -VV option and inspected the output? In particular, you’ll see lines like this:

DEBUG: /Users/ddeleo/oc/all_cookbooks/mysql/templates/default/grants.sql.erb has not changed

Do you get such a line for your template?

Also, with knife cookbook show COOKBOOK VERSION, you get the raw data the server stores about the cookbook, including md5s of each of the files and pre-signed URLs to download them. Can you check whether these pertain to the new or old files?

Finally, do you have more than one directory configured as your cookbook_path, and is there a version of the cookbook in more than one of these directories?

"If chef-client is downloading a different version than you expected, it could be caused by "

"dependency constraints in your environment or in other cookbooks,"
we are not using any constraints in our environments. period.

Dependency contraints in cookbooks will be honored, so the dependency solver still needs to get the set of cookbooks that honor those constraints even if there’s nothing in your environments.

--
Daniel DeLeo

knife cookbook show COOKBOOK VERSION shows me the mdf hash of the old
template file, which happens to be the same file obtained when downloading
the cookbook.
I deleted all versions of the cookbook from the chef server so its only
offering one for download.

in plain terms
it was version 1.0.0(example), and i noticed the template wasn't changing
(as in, the file created by templates isnt different), so i change it to
1.0.1, deleted the cookbook "1.0.0" from the server, and uploaded new
version.

same results (template appears to be the old one still),

I downloaded the cookbook from server, and it downloaded the old template
file, not the new one)

it appears, by all indications, that the chef server is retaining the old
tempalte, even thru a knife cookbook delete,

On Wed, Mar 26, 2014 at 1:16 PM, Daniel DeLeo dan@kallistec.com wrote:

On Wednesday, March 26, 2014 at 12:56 PM, Kenneth Barry wrote:

"First of all, did you change the cookbook's version?"
Yes, I changed the version of the cookbook

" If so, you should check which version was downloaded to the client. "
i don't know how to see what version was downloaded to the client (do
you mean Node?), but what I do know if when i download from the chef server
"knife cookbook download [name]" I get the old template file (containing
the old content)

The most straightforward way to see what version is on a node is to look
at the metadata file in the cache directory.

Also, have you uploaded with the -VV option and inspected the output? In
particular, you'll see lines like this:

DEBUG:
/Users/ddeleo/oc/all_cookbooks/mysql/templates/default/grants.sql.erb has
not changed

Do you get such a line for your template?

Also, with knife cookbook show COOKBOOK VERSION, you get the raw data
the server stores about the cookbook, including md5s of each of the files
and pre-signed URLs to download them. Can you check whether these pertain
to the new or old files?

Finally, do you have more than one directory configured as your
cookbook_path, and is there a version of the cookbook in more than one of
these directories?

"If chef-client is downloading a different version than you expected, it
could be caused by "

"dependency constraints in your environment or in other cookbooks,"
we are not using any constraints in our environments. period.

Dependency contraints in cookbooks will be honored, so the dependency
solver still needs to get the set of cookbooks that honor those constraints
even if there's nothing in your environments.

--
Daniel DeLeo

On Wednesday, March 26, 2014 at 1:32 PM, Kenneth Barry wrote:

knife cookbook show COOKBOOK VERSION shows me the mdf hash of the old template file, which happens to be the same file obtained when downloading the cookbook.
I deleted all versions of the cookbook from the chef server so its only offering one for download.

in plain terms
it was version 1.0.0(example), and i noticed the template wasn't changing (as in, the file created by templates isnt different), so i change it to 1.0.1, deleted the cookbook "1.0.0" from the server, and uploaded new version.

same results (template appears to be the old one still),

I downloaded the cookbook from server, and it downloaded the old template file, not the new one)

it appears, by all indications, that the chef server is retaining the old tempalte, even thru a knife cookbook delete,

Did you check whether you have multiple copies of the cookbook locally? Knife will combine cookbooks that exist in multiple locations in your cookbook paths into a single cookbook with one overlaid on the other. This feature is deprecated and supposed to trigger a warning, but I just discovered that the warning was inadvertently removed, so it’s possible that you are triggering this feature accidentally without knowing it.

--
Daniel DeLeo

"Did you check whether you have multiple copies of the cookbook locally?"

please define "locally". Do you mean local ont he node, local on the chef
serve,r or local on, say, my box (in my repo????) ,or some other place

On Wed, Mar 26, 2014 at 2:53 PM, Daniel DeLeo dan@kallistec.com wrote:

On Wednesday, March 26, 2014 at 1:32 PM, Kenneth Barry wrote:

knife cookbook show COOKBOOK VERSION shows me the mdf hash of the old
template file, which happens to be the same file obtained when downloading
the cookbook.
I deleted all versions of the cookbook from the chef server so its only
offering one for download.

in plain terms
it was version 1.0.0(example), and i noticed the template wasn't
changing (as in, the file created by templates isnt different), so i change
it to 1.0.1, deleted the cookbook "1.0.0" from the server, and uploaded new
version.

same results (template appears to be the old one still),

I downloaded the cookbook from server, and it downloaded the old
template file, not the new one)

it appears, by all indications, that the chef server is retaining the
old tempalte, even thru a knife cookbook delete,

Did you check whether you have multiple copies of the cookbook locally?
Knife will combine cookbooks that exist in multiple locations in your
cookbook paths into a single cookbook with one overlaid on the other. This
feature is deprecated and supposed to trigger a warning, but I just
discovered that the warning was inadvertently removed, so it's possible
that you are triggering this feature accidentally without knowing it.

--
Daniel DeLeo

On Wednesday, March 26, 2014 at 3:04 PM, Kenneth Barry wrote:

"Did you check whether you have multiple copies of the cookbook locally?"

please define "locally". Do you mean local ont he node, local on the chef serve,r or local on, say, my box (in my repo????) ,or some other place
On your workstation where you use knife. I wrote this script you can use to check: Show all the places where you have multiple cookbooks that shadow each other. · GitHub

--
Daniel DeLeo

This happened to me just the other day.

I spent an hour on it before a coworker pointed out that I had a different
cookbook path in my knife.rb (in ~/.chef) than then cookbook I was editing.

How'd I get to that point? I had cloned my repo into a new location to do
some comparisons and didn't realize I had it in an old location.

On Wednesday, March 26, 2014, Daniel DeLeo dan@kallistec.com wrote:

On Wednesday, March 26, 2014 at 3:04 PM, Kenneth Barry wrote:

"Did you check whether you have multiple copies of the cookbook locally?"

please define "locally". Do you mean local ont he node, local on the
chef serve,r or local on, say, my box (in my repo????) ,or some other place
On your workstation where you use knife. I wrote this script you can use
to check: Show all the places where you have multiple cookbooks that shadow each other. · GitHub

--
Daniel DeLeo