VMware Cloud Community
ghman
Enthusiast
Enthusiast
Jump to solution

Orchestrator Read from Local Data File

I run my workflows on computer xyz. On this machine I have several data files that I would like to read in and use that data in the workflow. These files are modified fairly regularly.

I run the following code and get the following error:

var myFileReader = new FileReader("c:\\path\file.csv");

myFileReader.open();

testrecord = myFileReader.readAll(); //testrecord is a String variable

myFileReader.close();

Permission denied on file '/var/lib/vco/app-server/bin/c:\path\file.csv' , read not allowed

This shows that orchestrator is trying to read the file from the VCO Appliance vs. my local machine.

Is it possible to have VCO read a file on my local box xyz? Having this file uploaded to the VCO appliance on every modification may be a bridge too far.

Thank you very much for any help.

1 Solution

Accepted Solutions
Burke-
VMware Employee
VMware Employee
Jump to solution

The Orchestrator appliance cannot automatically access your local machine (like any server). Instead, files that need to be accessed by Orchestrator should be provided in one of the following ways:

  • Use mimeAttachment as an input to the workflow(s) you need to run and provide the file(s) at time of workflow execution, then get the contents of the mimeAttachment in your scripts and process as desired
  • Store the file(s) on a network share visible to the Orchestrator server (the vRO Appliance(s) would need to mount the share AND have the local filesystem rights enabled as per vRO Docs file-io-rights.conf)
  • Store the file(s) as Resource elements on the Orchestrator server (this option is better for somewhat static files such as text based templates, INF files, etc...)
If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter

View solution in original post

0 Kudos
9 Replies
Burke-
VMware Employee
VMware Employee
Jump to solution

The Orchestrator appliance cannot automatically access your local machine (like any server). Instead, files that need to be accessed by Orchestrator should be provided in one of the following ways:

  • Use mimeAttachment as an input to the workflow(s) you need to run and provide the file(s) at time of workflow execution, then get the contents of the mimeAttachment in your scripts and process as desired
  • Store the file(s) on a network share visible to the Orchestrator server (the vRO Appliance(s) would need to mount the share AND have the local filesystem rights enabled as per vRO Docs file-io-rights.conf)
  • Store the file(s) as Resource elements on the Orchestrator server (this option is better for somewhat static files such as text based templates, INF files, etc...)
If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
ghman
Enthusiast
Enthusiast
Jump to solution

Most unfortunate. Thanks for the help and quick response.

0 Kudos
carl1
Expert
Expert
Jump to solution

I don't understand the comment "most unfortunate".  You simply have "MimeAttachment" as an input to your workflow.  The user is prompted to specify the file and then you access the content attribute.  How easy is that!

0 Kudos
qc4vmware
Virtuoso
Virtuoso
Jump to solution

I think this would work for him if you could load up the mime attachment programatically. I just tried but it doesn't seem to work.  I did the following:

var file = new File("/some/file/here.txt");

var mimeAttachment = new MimeAttachment(file);

System.log(mimeAttachment.content);

System.log(mimeAttachment.mimeType);

It seems like this should work but it doesn't.  There is no content.  The mimeType does show as text/plain but I can't get any content to be displayed.  If I use the same file as an input and manually select it then it works.  Bug or design?

Paul

0 Kudos
ghman
Enthusiast
Enthusiast
Jump to solution

Carl, I appreciate the feed back. My reply to Burke may have been a little clearer if I had explained a little more.

My workflows are not being run by my clients directly. These are run via PERL accessing the Orchestrator REST API. All I have is a JSON to pass to orchestrator.

I attempted to use the MimeAttachment however, I am lost as to how to pull the Mime from my local box when all I have passed to me is a string path location to the file.

So basically I receive c:\path\file.csv via JSON and then I have to attach the Mime based on that.

If anyone has input into that I would appreciate the help. I marked Burke as correct answer because he is correct and now the finer details of implementation are eluding me.

Thanks for the help.

0 Kudos
ghman
Enthusiast
Enthusiast
Jump to solution

Paul - thats exactly what I was trying but failing as well.

0 Kudos
Burke-
VMware Employee
VMware Employee
Jump to solution

Unfortunately, I'm not much of a PERL expert so I would need to do lots of searching and testing to figure this out... essentially, you should search for an example of PERL Posting a MimeAttachment and check the vRO API doc to pass that file as a MimeAttachment as part of the input... HOWEVER... in looking at your example, I'm seeing that your example is .csv .... this leads to the question: Is each file simply a csv text file??? If so, forget about MimeAttachment - that's a bit complicated I think. Instead, use "string" as the input type to the workflow that needs this csv content. Now, write your PERL script to get the contents of the csv file (that can't be terribly difficult to figure out...) and pass that string content to the input of the workflow.

End result:

PERL script executed (locally - NOT on vRO Server, I hope this has been the message the whole time Smiley Wink )

- PERL script extracts contents of c:\path\file.csv into a string variable

- PERL script formats JSON for vRO Workflow, including the string variable extracted from the csv file

- PERL executes vRO workflow using the JSON formatted body

vRO Starts workflow, parses CSV string as desired.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
carl1
Expert
Expert
Jump to solution

Ahhh, that makes a lot more sense.  Thanks and sorry, I don't have any solution.  I will let the other guys work it out.  The options to pass it from perl as a string is an interesting idea.

Carl L.

0 Kudos
ghman
Enthusiast
Enthusiast
Jump to solution

Thanks all. I think Burke nailed it (Yes, the list of assumptions and flow is right on). I'll look into passing a Mime from PERL but passing the file contents as a string is something I can slap together in a couple minutes so I'll start there to get this going and loop back around later.