cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

system.importSystem filename, branchNodeID - filename does not work....

Jump to solution

Hi, maybe someone can help me ?

in Python I am trying to execute the command:

>>>mc.system.importSystem('file:///d:/tools/tree.txt','2')

true  (this is the response that I get)

I can manually import this flat file when logged into the "regular" ePO console, via the system tree actions, new systems, I provide this tree.txt file and it will create the entire tree as expected.

(no computers are actually in this tree.txt)

if I run the above command I get the response true  and if I refresh the tree, it only shows that one computer "com" was added to the root of the tree (nodeID 2 is the root)

what I am doing wrong, why is this file not imported ???

does someone know what flattenTreeStructure means and how I would have to use this optional parameter ?

regards,

Andre

1 Solution

Accepted Solutions

Re: system.importSystem filename, branchNodeID - filename does not work....

Jump to solution

This is a bit confusing. By default, it's expecting this parameter to be the list of file names. To get the desired behavior, we have to do this instead:

>>> mc.system.importSystem(uploadFile="file:///d:\tools\tree.txt", branchNodeID=2);

The "flattenTreeStructure" parameter is either "true" or "false" and is analogous to the radio button you see when you are in the ePO console and you go to System Tree > New Systems and select "Import systems from a text file". Here you will see an option to import either "Systems and System Tree structure" (the default) or "Systems only (as a flat list)". Setting "flattenTreeStructure" to "true" is equivalent to choosing this second option: it will not build a tree structure even if one is indicated in your text file.

View solution in original post

5 Replies
barena
Level 7
Report Inappropriate Content
Message 2 of 6

Re: system.importSystem filename, branchNodeID - filename does not work....

Jump to solution

Hi

I have the exact same problem too. Importing the text file with multiple computer names (one per line) produces the same result, a single computer-generated named com within the group indicated.

Instead, if explicitly names on the command line (mc.system.importSystem ('test1, test2, test3', '15 '), it is operating correctly.

Strangely, trough the API Explorer Web tools ePO, import command works correctly and pass the file name.

I think McAfee needs to fix something.

regards

barena

Re: system.importSystem filename, branchNodeID - filename does not work....

Jump to solution

This is a bit confusing. By default, it's expecting this parameter to be the list of file names. To get the desired behavior, we have to do this instead:

>>> mc.system.importSystem(uploadFile="file:///d:\tools\tree.txt", branchNodeID=2);

The "flattenTreeStructure" parameter is either "true" or "false" and is analogous to the radio button you see when you are in the ePO console and you go to System Tree > New Systems and select "Import systems from a text file". Here you will see an option to import either "Systems and System Tree structure" (the default) or "Systems only (as a flat list)". Setting "flattenTreeStructure" to "true" is equivalent to choosing this second option: it will not build a tree structure even if one is indicated in your text file.

View solution in original post

barena
Level 7
Report Inappropriate Content
Message 4 of 6

Re: system.importSystem filename, branchNodeID - filename does not work....

Jump to solution

Very well, a warm thanks for the help!


In fact I made ​​several tests, including using the parameter UploadFile, but I was not able to peck the correct syntax.

In fact, using the python remote client the correct syntax is:

barena

  >>> mc.system.importSystem (UploadFile = "file: / / / d: \ tools \ tree.txt" branchNodeID = '2');

Where the entire branchNodeID it should be placed in quotation marks.

Fully confirm the proper execution of the command to the remote client python.

thanks again

best regard

Re: system.importSystem filename, branchNodeID - filename does not work....

Jump to solution

Thanks,

this is working like a charm now !

Barena, thanks too but there are 2 errors : UploadFile should be uploadFile  (lowercase u) and you missed the comma after the first argument

>>> mc.system.importSystem(uploadFile="file:///d:\Tools\Andre\TreeStructure.txt",branchNodeID = '2');

python seems very sensitive to the case of the letters....

Re: system.importSystem filename, branchNodeID - filename does not work....

Jump to solution

I have been playing with Python a bit more, I am now doing the following call :

python.exe import.py username password d:\Tools\Andre\TreeStructure.txt 2

and import.py contains:

import mcafee
import sys
import string

usrname=sys.argv[1]
pwd=sys.argv[2]
tr="file:///"
tr+=sys.argv[3]
br=sys.argv[4]

mc = mcafee.client('localhost','38443',usrname,pwd)
mc.system.importSystem(uploadFile=tr,branchNodeID=br)

exit()

and this worked like a charm now

I am running most of my script in powershell, but I did not manage yet to run this import in powershell, so now I can just call this routine out of powershell and pass on the variables out of powershell to the python script this way.

More McAfee Tools to Help You

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community