Of course (sigh), my solution comes with two caveats:
– first of all, file size limit for uploads from the desktop to the Orchestrator appliance is 2Mb. Yes, Mb.
– And you cannot invoke this VRO workflow as a Resource Action from VRA, because there is no field type “mime attachment” in VRA yet.
Best regards
]]>Very cool. Thank you for sharing!
]]>Hello Nick, it turned out that was my fault… again. 🙁
Now it’s working, I modified the workflow this way:
Input PARAMETERS:
localFile (MimeAttachment) – let the user choose the file inside his PC
vroFileName (string) – let the user choose the file name on VRO
Input ATTRIBUTES:
vroPath (string) – taken from a Configuration Item on the Orchestrator
vroFile (MimeAttachment)
Scriptable Action:
var vroFile = localFile;
vroFile.write(vroPath,vroFileName);
Could you use winscp or something else to move the file from your desktop to the orchestrator server?
]]>System.log(“localFile: ” + localFile);
var mimeAttachment = new MimeAttachment(localFile);
System.log(mimeAttachment.mimeType);
mimeAttachment.write(“”, “mybeautifulfile.iso”);
The workflow fails with these log entries:
[2016-10-03 16:16:08.031] [I] localFile: h:\iso\MARIADB-GALERA.ISO
[2016-10-03 16:16:08.041] [I] application/octet-stream
[2016-10-03 16:16:08.046] [E] Permission denied on directory ‘/var/lib/vco/app-server/bin’
I’d rather avoid giving rwx permissions on /var/lib/vco/app-server/bin directory, so I created /var/lib/vco/app-server/bin/uploads directory, gave it rwx permissions, added it to js-io-rights.conf, restarted both VRO services and modified the script this way:
If the first parameter of the mimeAttachment.write function is “something else” (I tried with “uploads”, “uploads/”, “/uploads”, “/uploads/”) then my workflow fails with
[2016-10-03 17:13:00.791] [I] localFile: h:\iso\MARIADB-GALERA.ISO
[2016-10-03 17:13:00.831] [I] application/octet-stream
[2016-10-03 17:13:00.836] [E] Error in (Workflow:Copy of copyFileToGuest / Scriptable task (item1)#4) Wrapped java.lang.NullPointerException
Given that the API explorer for mimeattachment.write is quite cryptic (at least for me), what am I doing wrong?
Of course I tried to reference the previously created /vcofiles directory (that has the correct permissions and references in js-io-rights.conf) but I keep getting NullPointerException.
Thanks in advance
Best regards
A confused italian