Site installing tomcat cookbook git deleted files from my java cookbook


#1

hi. is this expected? maybe it’s something i don’t understand about git
and git branching and community cookbooks.

long ago i had done “knife cookbook site install java”, and committed
that cookbook to my own git repo. over time, i modifed that java
cookbook (added some templates, modifed the default recipe).

just now i did a “knife cookbook site install tomcat”, and doing so
whacked my mods to the java cookbook.

whaaa? what to do?

thanks,
kallen

01/11 02:53[kallen@chef-repo ]$ knife cookbook site install tomcat
Installing tomcat to /home/kallen/sbox/ops/chef-repo/cookbooks
Checking out the master branch.
Creating pristine copy branch chef-vendor-tomcat
Downloading tomcat from the cookbooks site at version 0.10.3 to /home/kallen/sbox/ops/chef-repo/cookbooks/tomcat.tar.gz
Cookbook saved: /home/kallen/sbox/ops/chef-repo/cookbooks/tomcat.tar.gz
Removing pre-existing version.
Uncompressing tomcat version /home/kallen/sbox/ops/chef-repo/cookbooks.
removing downloaded tarball
1 files updated, committing changes
Creating tag cookbook-site-imported-tomcat-0.10.3
Checking out the master branch.
Updating 4046342…5863ea6
Fast-forward
chef-repo/cookbooks/tomcat/README.md | 56 +++++++
chef-repo/cookbooks/tomcat/attributes/default.rb | 59 ++++++++
chef-repo/cookbooks/tomcat/metadata.rb | 16 ++
chef-repo/cookbooks/tomcat/recipes/default.rb | 78 ++++++++++
…/tomcat/templates/default/default_tomcat6.erb | 64 ++++++++
…/tomcat/templates/default/server.xml.erb | 155 ++++++++++++++++++++
…/tomcat/templates/default/sysconfig_tomcat6.erb | 59 ++++++++
7 files changed, 487 insertions(+), 0 deletions(-)
create mode 100644 chef-repo/cookbooks/tomcat/README.md
create mode 100644 chef-repo/cookbooks/tomcat/attributes/default.rb
create mode 100644 chef-repo/cookbooks/tomcat/metadata.rb
create mode 100644 chef-repo/cookbooks/tomcat/recipes/default.rb
create mode 100644 chef-repo/cookbooks/tomcat/templates/default/default_tomcat6.erb
create mode 100644 chef-repo/cookbooks/tomcat/templates/default/server.xml.erb
create mode 100644 chef-repo/cookbooks/tomcat/templates/default/sysconfig_tomcat6.erb
Cookbook tomcat version 0.10.3 successfully installed
Installing java to /home/kallen/sbox/ops/chef-repo/cookbooks
Checking out the master branch.
Creating pristine copy branch chef-vendor-java
Downloading java from the cookbooks site at version 1.1.0 to /home/kallen/sbox/ops/chef-repo/cookbooks/java.tar.gz
Cookbook saved: /home/kallen/sbox/ops/chef-repo/cookbooks/java.tar.gz
Removing pre-existing version.
Uncompressing java version /home/kallen/sbox/ops/chef-repo/cookbooks.
removing downloaded tarball
4 files updated, committing changes
Creating tag cookbook-site-imported-java-1.1.0
Checking out the master branch.
Updating 5863ea6…b9302f4
Fast-forward
chef-repo/cookbooks/java/attributes/default.rb | 11 ±
chef-repo/cookbooks/java/recipes/default.rb | 26 ±-
…/java/templates/default/java.security.erb | 290 --------------------
…/java/templates/default/profile-java-sh.erb | 4 -
4 files changed, 3 insertions(+), 328 deletions(-)
delete mode 100644 chef-repo/cookbooks/java/templates/default/java.security.erb
delete mode 100644 chef-repo/cookbooks/java/templates/default/profile-java-sh.erb
Cookbook java version 1.1.0 successfully installed
Installing apt to /home/kallen/sbox/ops/chef-repo/cookbooks
Checking out the master branch.
Creating pristine copy branch chef-vendor-apt
Downloading apt from the cookbooks site at version 1.2.2 to /home/kallen/sbox/ops/chef-repo/cookbooks/apt.tar.gz
Cookbook saved: /home/kallen/sbox/ops/chef-repo/cookbooks/apt.tar.gz
Removing pre-existing version.
Uncompressing apt version /home/kallen/sbox/ops/chef-repo/cookbooks.
removing downloaded tarball
3 files updated, committing changes
Creating tag cookbook-site-imported-apt-1.2.2
Checking out the master branch.
Updating b9302f4…a0389ef
Fast-forward
chef-repo/cookbooks/apt/README.md | 22 ++++++++++++±--------
chef-repo/cookbooks/apt/metadata.rb | 2 ±
chef-repo/cookbooks/apt/recipes/default.rb | 7 +++++++
3 files changed, 21 insertions(+), 10 deletions(-)
Cookbook apt version 1.2.2 successfully installed
Installing jpackage to /home/kallen/sbox/ops/chef-repo/cookbooks
Checking out the master branch.
Creating pristine copy branch chef-vendor-jpackage
Downloading jpackage from the cookbooks site at version 0.10.0 to /home/kallen/sbox/ops/chef-repo/cookbooks/jpackage.tar.gz
Cookbook saved: /home/kallen/sbox/ops/chef-repo/cookbooks/jpackage.tar.gz
Removing pre-existing version.
Uncompressing jpackage version /home/kallen/sbox/ops/chef-repo/cookbooks.
removing downloaded tarball
1 files updated, committing changes
Creating tag cookbook-site-imported-jpackage-0.10.0
Checking out the master branch.
Updating a0389ef…cd5f894
Fast-forward
chef-repo/cookbooks/jpackage/README.md | 50 +++++++++++++++++
chef-repo/cookbooks/jpackage/attributes/default.rb | 20 +++++++
chef-repo/cookbooks/jpackage/metadata.rb | 14 +++++
chef-repo/cookbooks/jpackage/recipes/default.rb | 58 ++++++++++++++++++++
…/jpackage/templates/default/jpackage.repo.erb | 49 +++++++++++++++++
…/jpackage/templates/fedora/jpackage.repo.erb | 49 +++++++++++++++++
6 files changed, 240 insertions(+), 0 deletions(-)
create mode 100644 chef-repo/cookbooks/jpackage/README.md
create mode 100644 chef-repo/cookbooks/jpackage/attributes/default.rb
create mode 100644 chef-repo/cookbooks/jpackage/metadata.rb
create mode 100644 chef-repo/cookbooks/jpackage/recipes/default.rb
create mode 100644 chef-repo/cookbooks/jpackage/templates/default/jpackage.repo.erb
create mode 100644 chef-repo/cookbooks/jpackage/templates/fedora/jpackage.repo.erb
Cookbook jpackage version 0.10.0 successfully installed
Installing java to /home/kallen/sbox/ops/chef-repo/cookbooks
Checking out the master branch.
Pristine copy branch (chef-vendor-java) exists, switching to it.
Downloading java from the cookbooks site at version 1.1.0 to /home/kallen/sbox/ops/chef-repo/cookbooks/java.tar.gz
Cookbook saved: /home/kallen/sbox/ops/chef-repo/cookbooks/java.tar.gz
Removing pre-existing version.
Uncompressing java version /home/kallen/sbox/ops/chef-repo/cookbooks.
removing downloaded tarball
No changes made to java
Checking out the master branch.
Installing apt to /home/kallen/sbox/ops/chef-repo/cookbooks
Checking out the master branch.
Pristine copy branch (chef-vendor-apt) exists, switching to it.
Downloading apt from the cookbooks site at version 1.2.2 to /home/kallen/sbox/ops/chef-repo/cookbooks/apt.tar.gz
Cookbook saved: /home/kallen/sbox/ops/chef-repo/cookbooks/apt.tar.gz
Removing pre-existing version.
Uncompressing apt version /home/kallen/sbox/ops/chef-repo/cookbooks.
removing downloaded tarball
No changes made to apt
Checking out the master branch.

01/11 02:58[kallen@chef-repo]$ git branch -a
chef-vendor-apt
chef-vendor-java
chef-vendor-jpackage
chef-vendor-route53
chef-vendor-s3cmd
chef-vendor-tomcat

  • master
    remotes/origin/HEAD -> origin/master
    remotes/origin/master

#2

On Wed, Jan 11, 2012 at 4:08 AM, kallen@groknaut.net wrote:

hi. is this expected? maybe it’s something i don’t understand about git
and git branching and community cookbooks.

long ago i had done “knife cookbook site install java”, and committed
that cookbook to my own git repo. over time, i modifed that java
cookbook (added some templates, modifed the default recipe).

just now i did a “knife cookbook site install tomcat”, and doing so
whacked my mods to the java cookbook.

Uhm, I see this though:

Creating pristine copy branch chef-vendor-java

So it seems knife disagrees, and couldn’t find your previous site-install
of the java cookbook.
Otherwise it would have merged them instead of overwriting them.
Double check your history—computers are usually more correct about this
kind of stuff than human memory :wink:

Andrea


#3

On Wednesday, January 11, 2012 at 4:38 AM, Andrea Campi wrote:

On Wed, Jan 11, 2012 at 4:08 AM, <kallen@groknaut.net (mailto:kallen@groknaut.net)> wrote:

hi. is this expected? maybe it’s something i don’t understand about git
and git branching and community cookbooks.

long ago i had done “knife cookbook site install java”, and committed
that cookbook to my own git repo. over time, i modifed that java
cookbook (added some templates, modifed the default recipe).

just now i did a “knife cookbook site install tomcat”, and doing so
whacked my mods to the java cookbook.

Uhm, I see this though:

Creating pristine copy branch chef-vendor-java

So it seems knife disagrees, and couldn’t find your previous site-install of the java cookbook.
Otherwise it would have merged them instead of overwriting them.
Double check your history—computers are usually more correct about this kind of stuff than human memory :wink:

Andrea
cookbook site install shouldn’t ever do anything that can’t be reverted (that is, it should error out whenever your repo has uncommitted changes). So check the git log and use git checkout REV or git reset --hard REV to get back to the previous state.


Dan DeLeo


#4

thanks for the responses. i’ll have to dig into my git history. at least
i’m now assured that i wasn’t going on about my workflow in completely
the wrong way.

On Wed, 11 Jan 2012, Daniel DeLeo wrote:

On Wednesday, January 11, 2012 at 4:38 AM, Andrea Campi wrote:

On Wed, Jan 11, 2012 at 4:08 AM, <kallen@groknaut.net (mailto:kallen@groknaut.net)> wrote:

hi. is this expected? maybe it’s something i don’t understand about git
and git branching and community cookbooks.

long ago i had done “knife cookbook site install java”, and committed
that cookbook to my own git repo. over time, i modifed that java
cookbook (added some templates, modifed the default recipe).

just now i did a “knife cookbook site install tomcat”, and doing so
whacked my mods to the java cookbook.

Uhm, I see this though:

Creating pristine copy branch chef-vendor-java

So it seems knife disagrees, and couldn’t find your previous site-install of the java cookbook.
Otherwise it would have merged them instead of overwriting them.
Double check your history???computers are usually more correct about this kind of stuff than human memory :wink:

Andrea
cookbook site install shouldn’t ever do anything that can’t be reverted (that is, it should error out whenever your repo has uncommitted changes). So check the git log and use git checkout REV or git reset --hard REV to get back to the previous state.


#5

Andrea,
I think I had a similar issue, where initially on the master branch, I just copied the java cookbook into place on the filesystem(no knife command at all). I subsequently did as you did and used knife to install the cookbook, which created the vendor branches and then does a merge to master(seemingly overwriting the java cookbook, that I had manually installed initially). I never did track it down, as I had a backup of the repo anyway, and just did my own merge. Maybe you did something similar initially?

                                             Sc0tt....

From: Andrea Campi [andrea.campi@zephirworks.com]
Sent: 11 January 2012 14:38
To: chef@lists.opscode.com
Subject: [chef] Re: site installing tomcat cookbook git deleted files from my java cookbook

On Wed, Jan 11, 2012 at 4:08 AM, <kallen@groknaut.netmailto:kallen@groknaut.net> wrote:

hi. is this expected? maybe it’s something i don’t understand about git
and git branching and community cookbooks.

long ago i had done “knife cookbook site install java”, and committed
that cookbook to my own git repo. over time, i modifed that java
cookbook (added some templates, modifed the default recipe).

just now i did a “knife cookbook site install tomcat”, and doing so
whacked my mods to the java cookbook.

Uhm, I see this though:

Creating pristine copy branch chef-vendor-java

So it seems knife disagrees, and couldn’t find your previous site-install of the java cookbook.
Otherwise it would have merged them instead of overwriting them.
Double check your history—computers are usually more correct about this kind of stuff than human memory :wink:

Andrea


#6

On Thu, Jan 12, 2012 at 4:53 PM, RUSSELL Scott <Scott.RUSSELL@echa.europa.eu

wrote:

Andrea,
I think I had a similar issue, where initially on the master
branch, I just copied the java cookbook into place on the filesystem(no
knife command at all). I subsequently did as you did and used knife to
install the cookbook, which created the vendor branches and then does a
merge to master(seemingly overwriting the java cookbook, that I had
manually installed initially). I never did track it down, as I had a
backup of the repo anyway, and just did my own merge. Maybe you did
something similar initially?

All the quoting made the thread difficult to follow, it was kallen who had
the issue :slight_smile:
But yeah, that’s what I thought too. And as Daniel said, the history is
still there, just reverting (part of) a commit should get everything
back—and it will not happen again after that.


#7

Don’t forget you can always use the git reflog to find the ref of a
commit that you… misplaced? It’s local to the repository.

–AJ

On 13 January 2012 05:27, Andrea Campi andrea.campi@zephirworks.com wrote:

On Thu, Jan 12, 2012 at 4:53 PM, RUSSELL Scott
Scott.RUSSELL@echa.europa.eu wrote:

Andrea,
I think I had a similar issue, where initially on the master
branch, I just copied the java cookbook into place on the filesystem(no
knife command at all). I subsequently did as you did and used knife to
install the cookbook, which created the vendor branches and then does a
merge to master(seemingly overwriting the java cookbook, that I had manually
installed initially). I never did track it down, as I had a backup of the
repo anyway, and just did my own merge. Maybe you did something similar
initially?

All the quoting made the thread difficult to follow, it was kallen who had
the issue :slight_smile:
But yeah, that’s what I thought too. And as Daniel said, the history is
still there, just reverting (part of) a commit should get everything
back—and it will not happen again after that.