3 Replies Latest reply on Aug 25, 2014 3:10 PM by Brian Soefje

    Sync Map some detail nodes

    Brian Soefje
      Share This:

      We have a requirement to get local unix accounts and their relationship to the server into the CMDB.

      I have built a rough pattern to handle the discovery. It creates a detail node of type "Local Unix Account" for each user. This is then related to the host. I am now having issues with the sync map pattern. What am I missing? I am getting an User error in extension  'unix_detail_node' not set.

      Below is the sync map:

       

      from CMDB.Host_ComputerSystem import Host_ComputerSystem 1.2;

      syncmapping UNIX_Local_Accounts 2.0

          """

          Host Local Account Detail nodes mapped to BMC_Account.

          """

      overview

              tags CMDB, Core_Mapping;

              datamodel 0, 1, 2, 3, 4, 5, 6;

      end overview;

       

      mapping from Host_ComputerSystem.host as host

           traverse ElementWithDetail:Detail:Detail:Detail where type matches "Local Unix Accounts" as unix_detail_node

           account -> BMC_Account;

           end traverse;

      end mapping;


      body

      computersystem := Host_ComputerSystem.computersystem;

      log.info("Process Local Account Detail for %host.name%");

      hostname := host.hostname;

      acct_name := unix_detail_node.name;

      sync_name := "%acct_name% on %hostname%";


      for each unix_detail_node do

           log.info("Mapping Account %unx_detail_node% to host %host.name%");

           account := sync.BMC_Account(

           key := unix_detail_node.key,

           Name := sync_name,

           ShortDescription := unix_detail_node.name,

          Description := unix_detail_node.comments,

           Category := "Miscellaneous",

           Type := "Account",

          Item := "Local"

          );


            // Relate the BMC_ComputerSystem to the new BMC_Account

           sync.rel.BMC_AccountOnSystem(

               Source      := computersystem,

               Destination := account,

                Name        := "ACCOUNTONSYSTEM"

           );


      end for;


      end body;

      end syncmapping;

       

       

      Thanks for any help!