Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-169

replace catalog command fails with empty edges

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PDB 1.5.0
    • Fix Version/s: PDB 1.6.0
    • Component/s: None
    • Labels:
    • Template:

      Description

      Dear puppeteers,

      I came across this problem, when manually inserting a fictitious catalog into PuppetDB.

      The following insertion works:

      [root@puppet05 ~]# curl -vv -G -H "Accept: application/json" 'http://localhost:8080/v2/commands' --data-urlencode 'payload={
        "command": "replace catalog",
        "version": 2,
        "payload": "{
          \"metadata\": {
            \"api_version\": 1
          },
          \"data\":   {
            \"name\":      \"puppet09.cscs.ch\",
            \"version\":   \"1111\",
            \"edges\":     [
      {\"source\": {\"type\": \"Service\", \"title\": \"iptables\"},
       \"target\": {\"type\": \"Service\", \"title\": \"iptables\"},
       \"relationship\": \"before\"}
            ], 
            \"resources\": [
      {\"type\": \"Service\",
       \"title\": \"iptables\",
       \"exported\": false,
       \"file\": \"/etc/puppet/modules/puppetdb/manifests/server.pp\",
       \"line\": 121,
       \"tags\": [\"node\", \"puppetdb\"],
       \"parameters\": {\"hasrestart\": true,
                        \"ensure\" : \"running\"}
      }
            ]
          }
        }"
      }'
      

      But if you leave "edges" as an empty list, it fails with this error:

          2013-10-15 11:20:43,042 ERROR [command-proc-45] [puppetdb.command] [15abcd55-b7c6-4acc-8839-94b96f85ba68] [replace catalog] Retrying after attempt 8, due to: org.postgresql.util.PSQLException: No value specified for parameter 1.
      

      Doing some debugging, you see this:

          2013-10-15 14:29:49,635 DEBUG [command-proc-46] [bonecp.StatementHandle] INSERT INTO edges (catalog,source,target,type) VALUES (?,?,?,?)
      

      And I guess this is where it fails.

      Besides, if you try to insert a catalog WITHOUT resources (empty list) the error is different:

          2013-10-15 10:42:02,060 ERROR [command-proc-45] [puppetdb.command] [43c41752-e7d4-4725-b062-7b3a9b1ac8ec] [replace catalog] Retrying after attempt 8, due to: org.postgresql.util.PSQLException: ERROR: syntax error at or near ")"
            Position: 66
      

      But I guess this is not that important: a catalog without resources does not make sense, but without edges I suppose it does.

      Thanks,
      Pablo

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            redmine.exporter redmine.exporter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support