Issue #9702 has been updated by Justin Stoller.

I've been able to replicate this using Puppet Enterprise 2.0 on UbuntuLTS 
32-bit (The ruby packaged is 1.8.7-p357 I believe).

Using a basic PE setup with a agent/master/dashboard on the same node and 
another node with just an agent.

>From a basic PE setup I install `gcc` and `build-essential`

I install the pe-ruby1.8-dev package to get the ruby development headers.

I install `postgresql` and `postgresql-server-dev-8.4`.

Using PE's included gem I install `pg`.

I created a user 'console' and db 'console_inventory_service' per the 
puppet.conf's settings and granted create to console on the db.

Then I change the `dbadapter = mysql` to `dbadapter = postgresql` and restart 
the master's and postgres' daemons.

I get:

<pre>

root@ubuntu-alpha# puppet agent -t
info: Retrieving plugin
info: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
err: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Puppet::Util::RetryAction::RetryException::RetriesExceeded
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

</pre>

I get this in the postgresql log:

<pre>

2012-01-18 16:43:58 PST STATEMENT:  INSERT INTO "inventory_facts" ("name", 
"value", "node_id") VALUES('kernel', 'Linux', 1) RETURNING "id"
2012-01-18 16:43:58 PST ERROR:  column "id" does not exist at character 99
2012-01-18 16:43:58 PST STATEMENT:  INSERT INTO "inventory_facts" ("name", 
"value", "node_id") VALUES('kernel', 'Linux', 1) RETURNING "id"
2012-01-18 16:43:59 PST ERROR:  column "id" does not exist at character 99
2012-01-18 16:43:59 PST STATEMENT:  INSERT INTO "inventory_facts" ("name", 
"value", "node_id") VALUES('kernel', 'Linux', 1) RETURNING "id"
2012-01-18 16:43:59 PST ERROR:  column "id" does not exist at character 99
2012-01-18 16:43:59 PST STATEMENT:  INSERT INTO "inventory_facts" ("name", 
"value", "node_id") VALUES('kernel', 'Linux', 1) RETURNING "id"
2012-01-18 16:44:01 PST ERROR:  column "id" does not exist at character 99
2012-01-18 16:44:01 PST STATEMENT:  INSERT INTO "inventory_facts" ("name", 
"value", "node_id") VALUES('kernel', 'Linux', 1) RETURNING "id"

</pre>

doing a \d on the database gives me:

<pre>

                  List of relations
 Schema |          Name          |   Type   |  Owner  
--------+------------------------+----------+---------
 public | fact_names             | table    | console
 public | fact_names_id_seq      | sequence | console
 public | fact_values            | table    | console
 public | fact_values_id_seq     | sequence | console
 public | hosts                  | table    | console
 public | hosts_id_seq           | sequence | console
 public | inventory_facts        | table    | console
 public | inventory_nodes        | table    | console
 public | inventory_nodes_id_seq | sequence | console
 public | param_names            | table    | console
 public | param_names_id_seq     | sequence | console
 public | param_values           | table    | console
 public | param_values_id_seq    | sequence | console
 public | puppet_tags            | table    | console
 public | puppet_tags_id_seq     | sequence | console
 public | resource_tags          | table    | console
 public | resource_tags_id_seq   | sequence | console
 public | resources              | table    | console
 public | resources_id_seq       | sequence | console
 public | source_files           | table    | console
 public | source_files_id_seq    | sequence | console
(21 rows)

</pre>

deleting the database, recreating it, regranting privileges and changing 
puppet/rails/database/schema.rb according to Aditya Patawari's recommendation 
(ticket #9256, pull request: https://github.com/puppetlabs/puppet/pull/82 ) 
fixes the issue.

<pre>

root@ubuntu-alpha:~# puppet agent -t
info: Retrieving plugin
info: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
info: Caching catalog for ubuntu-alpha
info: Applying configuration version '1326934281'
notice: Finished catalog run in 1.81 seconds

</pre>

I've successfully verifed this twice now, let me if you need any more 
information.


----------------------------------------
Bug #9702: Issue with inventory PGError: ERROR:  column "id" does not exist
https://projects.puppetlabs.com/issues/9702

Author: Marco La Rosa
Status: Investigating
Priority: Normal
Assignee: Patrick Carlisle
Category: 
Target version: 2.7.x
Affected Puppet version: 2.7.1
Keywords: 
Branch: 


Hi,

I'm having an issue geting inventory going on my puppetmaster.

The master works happily with storeconfigs (Squeeze, 2.7.1-1~bpo60+1) until I 
enable "facts_terminus = inventory_active_record". Then I start seeing errors 
on the client (same OS and version of puppet) like:
<pre>
err: Could not retrieve catalog from remote server: Error 400 on SERVER: 
PGError: ERROR:  column "id" does not exist
LINE 1: ...', '2011-09-27 16:29:27.948893', 2, E'Bochs') RETURNING "id"
                                                                   ^
: INSERT INTO "inventory_facts" ("name", "created_at", "node_id", "value") 
VALUES(E'productname', '2011-09-27 16:29:27.948893', 2, E'Bochs') RETURNING "id"
</pre>

The db (Squeeze, postgres 9.0 - from backports) table looks like:
<pre>
puppet=# \d+ inventory_facts;
                        Table "public.inventory_facts"
   Column   |            Type             | Modifiers | Storage  | Description 
------------+-----------------------------+-----------+----------+-------------
 node_id    | integer                     | not null  | plain    | 
 name       | character varying(255)      | not null  | extended | 
 value      | text                        | not null  | extended | 
 created_at | timestamp without time zone |           | plain    | 
Indexes:
    "index_inventory_facts_on_node_id_and_name" UNIQUE, btree (node_id, name)
Has OIDs: no
</pre>

And the schema which I think defines all this (certainly the only one on the 
server that fits) /usr/lib/ruby/1.8/puppet/rails/database/schema.rb has:
<pre>
        create_table :inventory_facts, :id => false do |t|
          t.column :node_id, :integer, :null => false
          t.column :name, :string, :null => false
          t.column :value, :text, :null => false
        end

        add_index :inventory_facts, [:node_id, :name], :unique => true
</pre>

So assuming the schema file is correct (matches the schema file at 
https://github.com/lak/puppet/blob/master/lib/puppet/rails/database/schema.rb), 
is this a bug in the client  code? Should it be "RETURNING "node_id"

Thanks,
Marco


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