Bug Report: GenericInterface ConfigItemCreate fails with NIC parameter

English! place to talk about development, programming and coding
Post Reply
stephan14x
Znuny newbie
Posts: 17
Joined: 08 Jan 2014, 08:54
Znuny Version: 2.4 > 3.3 > 6 > 7.2
Real Name: Stephan Lang
Company: Bock 1 GmbH & Co. KG

Bug Report: GenericInterface ConfigItemCreate fails with NIC parameter

Post by stephan14x »

Summary

The GenericInterface ConfigItemCreate operation fails with "NIC parameter value is required and is missing!" even when the NIC parameter is correctly provided in the JSON request. Subsequently, the server crashes with a Perl error.

Znuny Version
  • Znuny 7.2.3
  • ITSMConfigurationManagement 7.2.1
  • ITSMCore 7.2.1
  • GeneralCatalog 7.2.1
Environment
  • Docker container with Debian 12 (bookworm)
  • MariaDB 10.11
  • Perl 5.36.0
  • Apache/mod_perl
Steps to Reproduce

1. Setup Web Service

Import a web service with ConfigItemCreate operation:

Code: Select all

Provider:
  Operation:
    ConfigItemCreate:
      Description: Create a ConfigItem
      MappingInbound:
        Type: Simple
      MappingOutbound:
        Type: Simple
      Type: ConfigItem::ConfigItemCreate
  Transport:
    Config:
      RouteOperationMapping:
        ConfigItemCreate:
          ParserBackend: JSON
          RequestMethod:
            - POST
          Route: /ConfigItem
    Type: HTTP::REST
2. Create a session

Code: Select all

curl -X POST "http://localhost/znuny/nph-genericinterface.pl/Webservice/API/Session" \
  -H "Content-Type: application/json" \
  -d '{"UserLogin":"agent","Password":"password"}'
3. Attempt to create a ConfigItem

Code: Select all

curl -X POST "http://localhost/znuny/nph-genericinterface.pl/Webservice/API/ConfigItem" \
  -H "Content-Type: application/json" \
  -d '{
    "SessionID": "<session_id>",
    "ConfigItem": {
      "Class": "Computer",
      "Name": "Test-Server",
      "DeplState": "Production",
      "InciState": "Operational",
      "CIXMLData": {
        "Vendor": "Generic",
        "Model": "Generic",
        "Description": "Test Server",
        "Type": "Server",
        "SerialNumber": "SN-001",
        "OperatingSystem": "Linux",
        "CPU": "Intel",
        "Ram": "4 GB",
        "HardDisk": "100 GB",
        "FQDN": "test-server.local",
        "NIC": {
          "IPoverDHCP": "No",
          "IPAddress": "127.0.0.1"
        }
      }
    }
  }'
4. Observe the error

First request returns:

Code: Select all

{
  "Error": {
    "ErrorCode": "ConfigItemCreate.MissingParameter",
    "ErrorMessage": "ConfigItemCreate: ConfigItem->CIXMLData->NIC parameter value is required and is missing!"
  }
}
Subsequent requests cause server crash (connection reset)

Expected Behavior

The ConfigItem should be created successfully when all required parameters including NIC are provided.

Actual Behavior
  1. The API returns "NIC parameter value is required and is missing!" despite NIC being present in the request
  2. After a few attempts, the server crashes with a Perl error
Error Logs

From /var/log/apache2/error.log:

Code: Select all

ERROR: GenericInterfaceProvider-10 Perl: 5.36.0 OS: linux

Message: DebugLog error: Summary: ConfigItemCreate.MissingParameter
Data: ConfigItemCreate: ConfigItem->CIXMLData->NIC parameter value is required and is missing!

RemoteAddress: 172.19.0.1
RequestURI: /znuny/nph-genericinterface.pl/Webservice/ZnunyCompleteAPI/ConfigItem

Traceback (206):
  Module: Kernel::GenericInterface::Debugger::DebugLog Line: 233
  Module: Kernel::GenericInterface::Debugger::Error Line: 327
  Module: Kernel::GenericInterface::Operation::Common::ReturnError Line: 120
  Module: Kernel::GenericInterface::Operation::ConfigItem::ConfigItemCreate::Run Line: 258
  Module: Kernel::GenericInterface::Operation::Run Line: 129
  Module: Kernel::GenericInterface::Provider::Run Line: 298
Crash error:

Code: Select all

[error] Can't use an undefined value as a HASH reference at
/opt/znuny/Kernel/GenericInterface/Operation/ConfigItem/Common.pm line 1087.
Tested NIC Formats

All of the following formats produce the same error:

Code: Select all

// Format 1: Object
"NIC": {
  "IPoverDHCP": "No",
  "IPAddress": "127.0.0.1"
}

// Format 2: Array
"NIC": [{
  "IPoverDHCP": "No",
  "IPAddress": "127.0.0.1"
}]

// Format 3: With NIC name
"NIC": {
  "NIC": "eth0",
  "IPoverDHCP": "No",
  "IPAddress": "127.0.0.1"
}

// Format 4: Minimal
"NIC": {
  "IPoverDHCP": "No"
}
Analysis

The error at ConfigItem/Common.pm line 1087 suggests that the code is trying to access a hash reference that is undefined. This likely occurs because:
  1. The JSON-to-Perl data structure conversion doesn't match what the ConfigItem module expects for nested/complex fields like NIC
  2. The validation logic checks for NIC presence before the data is properly parsed/structured
Workaround

Currently none found. ConfigItem creation via GenericInterface REST API appears to be broken for classes with complex CIXMLData schemas (like the default "Computer" class).

Additional Context
  • ConfigItemSearch operation works correctly
  • Session creation works correctly
  • The same ITSM packages work fine via the web UI
  • This was tested with a fresh Znuny 7.2.3 installation with default ITSM class definitions
Related Files
  • Kernel/GenericInterface/Operation/ConfigItem/ConfigItemCreate.pm
  • Kernel/GenericInterface/Operation/ConfigItem/Common.pm (line 1087)

This Report was created using Claude Code.
Started with OTRS 2.4 and used OTRS 6.0 until 2023
After a Year of Hell using a leading cloud tool, I'm resetting to OTRS Znuny - Voyager Reference intended
Currently building a new Znuny 7.2 system
Post Reply