From f9f35da4d428dc73c3c48bd920a35e49a4590782 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Mon, 13 Jan 2025 15:13:25 +0900 Subject: [PATCH] Create ovftool.js --- lib/ovftool.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 lib/ovftool.js diff --git a/lib/ovftool.js b/lib/ovftool.js new file mode 100644 index 0000000..ae6f8b5 --- /dev/null +++ b/lib/ovftool.js @@ -0,0 +1,56 @@ +// ovftool.js +// Namhyeon Go +// https://github.com/gnh1201/welsonjs +// +var SHELL = require("lib/shell"); +var CRED = require("lib/credentials"); + +function OVFObject() { + this.binPath = "bin/x64/VMware-ovftool-4.6.3-24031167-win.x86_64/ovftool/ovftool.exe"; + this.hostname = ""; + this.resourceName = ""; + + this.setBinPath = function(binPath) { + this.binPath = binPath; + }; + + this.setHostname = function(hostname) { + this.hostname = hostname; + }; + + this.setResourceName = function(resourceName) { + this.resourceName = resourceName; + }; + + this.saveTo = function() { + var cred = CRED.get("password", "ovftool"); + var connectionString = "vi://" + + cred.username + ":" + + encodeURIComponent(cred.password) + "@" + + this.hostname + "/" + + this.resourceName; + + // todo + + }; +} + +function setCredential(username, password) { + CRED.push("password", "ovftool", { + "hostname": hostname, + "username": username, + "password": password, + }); +} + +function create() { + return new OVFObject(); +} + +exports.setCredential = setCredential; +exports.create = create; + +exports.VERSIONINFO = "Broadcom/VMware OVF Tool interface (ovftool.js) version 0.1"; +exports.AUTHOR = "abuse@catswords.net"; +exports.global = global; +exports.require = global.require;