| Server IP : 34.87.99.72 / Your IP : 216.73.217.31 Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 User : bitnami ( 1000) PHP Version : 7.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /opt/bitnami/nami/node_modules/provisioner/lib/ |
Upload File : |
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const download_1 = require("./download");
const nami_wrapper_1 = require("./nami_wrapper");
const utils_1 = require("./utils");
var AssetType;
(function (AssetType) {
AssetType["BASH"] = "bash";
AssetType["NAMI"] = "nami";
})(AssetType = exports.AssetType || (exports.AssetType = {}));
/**
* Generic bitnami module class
*/
class BitnamiModule {
/**
* Create instance of generic bitnami module handler
* @param tierDefinition definition of current tier (part of multi-VM deployment)
* @param moduleDefinition definition of this specific module
*/
constructor(tierDefinition, moduleDefinition) {
this.tierDefinition = tierDefinition;
this.moduleDefinition = moduleDefinition;
this.baseName = moduleDefinition.name +
"-" + moduleDefinition.version +
"-" + this.osArchDistro(tierDefinition.provisioner.platform);
this.cloudFlags = moduleDefinition.cloudFlags || {};
this.skipInitialize = !!moduleDefinition.skipInitialize;
this.skipService = !!moduleDefinition.skipService;
this.startAfterInitialize = !!moduleDefinition.startAfterInitialize;
}
/**
* Url for downloading the bitnami module
*/
get downloadUrl() {
const downloadUrlOptionName = `${this.moduleDefinition.name}_nami_module_url`;
if (this.provisioner.options.provided(downloadUrlOptionName)) {
return this.provisioner.options.getValue(downloadUrlOptionName);
}
return this.moduleDefinition.tarballUrl || (`https://downloads.bitnami.com/files/stacksmith/${this.baseName}.tar.gz`);
}
/**
* Instance of provisioner
*/
get provisioner() {
return this.tierDefinition.provisioner;
}
/**
* Instance of logger
*/
get logger() {
return this.tierDefinition.provisioner.logger;
}
/**
* Short name of the module - i.e. `wordpress`
*/
get name() {
return this.moduleDefinition.name;
}
/**
* Version of the module - i.e. `4.5.2-0`
*/
get version() {
return this.moduleDefinition.version;
}
/**
* Download a module from repository and unpack it in destination directory
* @param destination Directory to unpack in, does not have to exist ;
* as bitnami modules are shipped inside their directory,
* the subdirectory will be created
*/
downloadAndUnpack(destination) {
return __awaiter(this, void 0, void 0, function* () {
let result;
nami_wrapper_1.file.mkdir(destination);
yield utils_1.retry(() => __awaiter(this, void 0, void 0, function* () {
result = yield new download_1.Download({
unpackDirectory: destination
// currently checksum is no used, no point in calculating it
// hashType: "sha256",
}).download(this.downloadUrl);
}), { logger: this.logger, errorMessage: "Unable to download bitnami module" });
});
}
/**
* Platform full-name, used for URLs - i.e. `linux-amd64-debian-9`
*/
osArchDistro(platform) {
return `${platform.osArch}-${platform.distro}-${platform.distroVersion}`;
}
}
exports.BitnamiModule = BitnamiModule;