Some custom pattern files are not appearing in the Pattern settings tab anymore after updating Discovery Tool from 2.x to 3.x and above

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform Notice: Data Center and Cloud By Request - This article was written for the Atlassian data center platform but may also be useful for Atlassian Cloud customers. If completing instructions in this article would help you, please contact Atlassian Support and mention it.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Some custom pattern files are not appearing in the Pattern settings tab anymore after updating Discovery Tool from 2.x to 3.x and above


Environment

Assets Discovery Tool 3.x and above


Diagnosis

When opening the Discovery Tool Settings from command prompt, the error below can be seen in the command prompt despite the Settings window opens successfully.

7/12/2024 12:22:17 PM: [Error] Error loading ScanPattern file: C:\Users\Administrator\Discovery\pattern\Linux_Hostinfo_DeviceType.pat
7/12/2024 12:22:17 PM: [Normal] Exceptions:
7/12/2024 12:22:17 PM: [Normal] There is an error in XML document (11, 4).
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)
   at Insight.Discovery.Tools.ObjectSerializer.XMLDeserializeObject[T](String xml) in C:\build\DISCOVERY-DISCOVERYCLOUDRELEASE228-BUILD\DiscoTools\ObjectSerializer.cs:line 419
   at Insight.Discovery.InfoClasses.ScanPatternList.TryLoadScanPatternFile(String patternFile) in C:\build\DISCOVERY-DISCOVERYCLOUDRELEASE228-BUILD\InfoClasses\ScanPatternList.cs:line 146
7/12/2024 12:22:17 PM: [Normal] Instance validation error: 'Hostinfo' is not a valid value for ScanPatternType.
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderScanPattern.Read2_ScanPatternType(String s)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderScanPattern.Read4_ScanPattern(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderScanPattern.Read5_ScanPattern()



Cause

The Linux_Hostinfo_DeviceType.pat is a custom pattern file in this example, and it has an invalid <PatternType> value, 'Hostinfo', for Discovery Tool 3.x and above.

<PatternType>Hostinfo</PatternType> only works for Discovery Tool version before 3.x and the expected value is 'Host'.


Solution

Use a valid pattern type as per the documentation for Pattern types. For this example, the correct pattern type is 'Host'.

Here's an extracted part of a default pattern file for Host type. Notice the line where the <PatternType> is. 

<?xml version="1.0" encoding="utf-8"?>
<!-- 
© Atlassian
-->
<ScanPattern xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Version>3.4.0</Version>
  <PatternID>Atlassian-Def-Linux-14</PatternID>
  <OrderNr>5</OrderNr>
  <ProcessType>SSHExecute</ProcessType>
  <PatternType>Host</PatternType>
  <Command>
...




Last modified on Aug 9, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.