Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-6229

Can't update asset records using provision.pl

    Details

      Description

      Here is how to reproduce the problem:

      $ ./provision.pl requisition add Test
      $ ./provision.pl node add Test mymac mymac
      $ ./provision.pl interface add Test mymac 10.0.0.1
      $ ./provision.pl node set asset Test mymac address1 "220 Chatham Business Drive"
      $ ./provision.pl node set asset Test mymac city "Pittsboro"
      $ ./provision.pl node set asset Test mymac state "NC"
      $ ./provision.pl node set asset Test mymac zip "27713"
      $ ./provision.pl node set asset Test mymac country "US"
      

      At this point, I should have my node with the proper asset data, but:

      $ ./provision.pl list Test
      * Test (last updated: 2013-11-09T10:08:06.737+01:00)
       * nodes:
         * mymac (foreign ID: mymac)
           * interfaces:
             * 10.0.0.1
      

      As you can see, there is no information about the asset fields I've added.

      If I use directly the ReST API it works as expected, for example:

      $ curl -v -u admin:admin -H 'Content-Type: application/xml' -d '<asset name="address1" value="220 Chatham Business Drive"/>' http://localhost:8980/opennms/rest/requisitions/Test/nodes/mymac/assets
      * Adding handle: conn: 0x7fdbc3004000
      * Adding handle: send: 0
      * Adding handle: recv: 0
      * Curl_addHandleToPipeline: length: 1
      * - Conn 0 (0x7fdbc3004000) send_pipe: 1, recv_pipe: 0
      * About to connect() to localhost port 8980 (#0)
      *   Trying ::1...
      * Connected to localhost (::1) port 8980 (#0)
      * Server auth using Basic with user 'admin'
      > POST /opennms/rest/requisitions/Test/nodes/mymac/assets HTTP/1.1
      > Authorization: Basic YWRtaW46YWRtaW4=
      > User-Agent: curl/7.30.0
      > Host: localhost:8980
      > Accept: */*
      > Content-Type: application/xml
      > Content-Length: 59
      > 
      * upload completely sent off: 59 out of 59 bytes
      < HTTP/1.1 303 See Other
      < Set-Cookie: JSESSIONID=1pz0nwhg4tkmnceh85sqzpnox;Path=/opennms
      < Expires: Thu, 01 Jan 1970 00:00:00 GMT
      < Location: http://localhost:8980/opennms/rest/requisitions/Test/nodes/mymac/assets/address1
      < Content-Length: 0
      * Server Jetty(7.6.12.v20130726) is not blacklisted
      < Server: Jetty(7.6.12.v20130726)
      < 
      * Connection #0 to host localhost left intact
      

      Now:

      $ ./provision.pl list Test
      * Test (last updated: 2013-11-09T10:34:16.949+01:00)
       * nodes:
         * mymac (foreign ID: mymac)
           * assets:
             * address1=220 Chatham Business Drive
           * categories:
             * Servers
           * interfaces:
             * 10.0.0.1
      

      Definitively, there is something wrong with provision.pl as the ReST API is working as expected.

        Attachments

          Activity

            People

            • Assignee:
              agalue Alejandro Galue
              Reporter:
              agalue Alejandro Galue
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: