Issue #4487 has been updated by Matt Robinson.

I'm not sure Markus' patch fixes anything since I can't find a code path that 
touches the code that was changed.  But I'm also unable to reproduce the 
problem, so I could be off.

Markus, did you ever hear back from Jason Koppe on if your change helped him?  
I wanted to add him as a watcher but he's not in the dropdown.  I forgot how to 
add people there.  For now I'll just email him separately to ask if your patch 
worked for him.

I'll keep looking, but when I run storeconfigs and get the hosts to update, it 
happens via this code path:

"/Users/matthewrobinson/work/puppet/lib/puppet/indirector/facts/active_record.rb:34:in
 `save'",
 "/Users/matthewrobinson/work/puppet/lib/puppet/node/facts.rb:15:in `save'",
 "/Users/matthewrobinson/work/puppet/lib/puppet/indirector.rb:64:in `save'",
 
"/Users/matthewrobinson/work/puppet/lib/puppet/indirector/catalog/compiler.rb:27:in
 `extract_facts_from_request'",

I started writing a test, but then thought I'd reproduce the problem since I 
got to wondering if the stubbed out node object we were describing in tests 
wasn't what it actually looked like when we got to the code in question in 
lib/puppet/rails/host.rb.

Here's the spec I started for host_spec.rb

+    describe "when storing the host in the database" do
+      before :each do
+        @resource1 = stub_everything 'res1'
+        @resource2 = stub_everything 'res2'
+        @resources = [ @resource1, @resource2 ]
+        Puppet::Rails::Host.stubs(:transaction).yields
+        Puppet::Rails::Host.expects(:find_by_name).with("foo").returns @host
+      end
+      it "should set parameters and then call save" do
+        @host.expects(:merge_facts)
+        @host.expects(:merge_resources)
+#       @host.expects(:environment=)
+#       @host.expects(:ip=)
+        @host.expects(:last_compile=)
+        @host.expects(:save)
+        Puppet::Rails::Host.store(@node, @resources).should == @host
+      end
+    end

----------------------------------------
Bug #4487: Environment column in hosts table updating incorrectly
http://projects.puppetlabs.com/issues/4487

Author: Jason Koppe
Status: Ready for Testing
Priority: High
Assignee: Matt Robinson
Category: 
Target version: 2.6.2
Affected version: 2.6.0
Keywords: storedconfig, mysql, environment, hosts table
Branch: http://github.com/MarkusQ/puppet/tree/ticket/2.6.x/4487


Posted on puppet-users at 
[thread/7237b49342ff9890](http://groups.google.com/group/puppet-users/browse_thread/thread/7237b49342ff9890)

Below I null out the environment column, show that it's null for a 
particular host, then run puppetd a few times on the host. 

<pre>
mysql for r...@localhost on indadm1> select * from hosts where name like 
'iad-web2%';
+----+---------------------+---------------+-------------+---------------------+-----------------+-------------+---------------------+----------------+---------------------+
| id | name                | ip            | environment | last_compile        
| last_freshcheck | last_report | updated_at          |source_file_id | 
created_at          |
+----+---------------------+---------------+-------------+---------------------+-----------------+-------------+---------------------+----------------+---------------------+
|  9 | iad-web2.indeed.net | 10.24.186.136 | NULL        | 2010-08-06 03:31:23 
| NULL            | NULL        | 2010-08-06 03:31:23 | NULL | 2010-06-08 
19:47:22 |
+----+---------------------+---------------+-------------+---------------------+-----------------+-------------+---------------------+----------------+---------------------+
1 row in set (0.00 sec)

mysql for r...@localhost on indadm1> select * from hosts where name 
like'iad-web2%';
+----+---------------------+---------------+----------------+---------------------+-----------------+-------------+---------------------+----------------+---------------------+
| id | name                | ip            | environment    | last_compile      
  | last_freshcheck | last_report | updated_at          | source_file_id | 
created_at          |
+----+---------------------+---------------+----------------+---------------------+-----------------+-------------+---------------------+----------------+---------------------+
|  9 | iad-web2.indeed.net | 10.24.186.136 | --- production | 2010-08-06 
03:31:23 | NULL            | NULL        | 2010-08-06 03:32:42 | NULL | 
2010-06-08 19:47:22 |
+----+---------------------+---------------+----------------+---------------------+-----------------+-------------+---------------------+----------------+---------------------+
1 row in set (0.00 sec)

mysql for r...@localhost on indadm1> select * from hosts where name like 
'iad-web2%';
+----+---------------------+---------------+----------------------+---------------------+-----------------+-------------+---------------------+----------------+---------------------+
| id | name                | ip            | environment          | 
last_compile        | last_freshcheck | last_report | updated_at          | 
source_file_id | created_at          |
+----+---------------------+---------------+----------------------+---------------------+-----------------+-------------+---------------------+----------------+---------------------+
|  9 | iad-web2.indeed.net | 10.24.186.136 | --- "--- production" | 2010-08-06 
03:32:50 | NULL            | NULL        | 2010-08-06 03:32:50 |           NULL 
| 2010-06-08 19:47:22 |
+----+---------------------+---------------+----------------------+---------------------+-----------------+-------------+---------------------+----------------+---------------------+
1 row in set (0.00 sec)

 </pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to