fix invalid syntax
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
3ba6bf5c8e
commit
ed4a065b6b
|
|
@ -1,59 +0,0 @@
|
||||||
FROM debian:10-slim
|
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
|
||||||
ARG BUILDPLATFORM
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
|
|
||||||
|
|
||||||
ENV LANG=en_US.utf8 NODE_VERSION=v12.20.0
|
|
||||||
|
|
||||||
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"
|
|
||||||
|
|
||||||
# install node
|
|
||||||
RUN apt-get update && apt-get install -y wget xz-utils
|
|
||||||
ADD docker/node-installer.sh /usr/local/sbin
|
|
||||||
RUN chmod +x /usr/local/sbin/node-installer.sh && node-installer.sh
|
|
||||||
ENV PATH=/usr/local/lib/nodejs/bin:$PATH
|
|
||||||
|
|
||||||
# node service requirements
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y e2fsprogs xfsprogs fatresize dosfstools nfs-common cifs-utils sudo && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# controller requirements
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y ansible && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# npm requirements
|
|
||||||
# gcc and g++ required by grpc-usd until proper upstream support
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y python make gcc g++ && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# install wrappers
|
|
||||||
ADD docker/iscsiadm /usr/local/sbin
|
|
||||||
RUN chmod +x /usr/local/sbin/iscsiadm
|
|
||||||
|
|
||||||
ADD docker/multipath /usr/local/sbin
|
|
||||||
RUN chmod +x /usr/local/sbin/multipath
|
|
||||||
|
|
||||||
# Run as a non-root user
|
|
||||||
RUN useradd --create-home csi \
|
|
||||||
&& mkdir /home/csi/app \
|
|
||||||
&& chown -R csi: /home/csi
|
|
||||||
WORKDIR /home/csi/app
|
|
||||||
USER csi
|
|
||||||
|
|
||||||
COPY package*.json ./
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
COPY --chown=csi:csi . .
|
|
||||||
|
|
||||||
USER root
|
|
||||||
|
|
||||||
EXPOSE 50051
|
|
||||||
ENTRYPOINT [ "bin/democratic-csi" ]
|
|
||||||
|
|
@ -115,7 +115,7 @@ try {
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(err.toString());
|
logger.error(`${err.toString()} ${err.stack}`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class ControllerZfsGenericDriver extends ControllerZfsBaseDriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getZetabyte() {
|
async getZetabyte() {
|
||||||
return registry.get(`${__REGISTRY_NS__}:zb`, () => {
|
return registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => {
|
||||||
const execClient = this.getExecClient();
|
const execClient = this.getExecClient();
|
||||||
const options = {};
|
const options = {};
|
||||||
options.executor = new ZfsSshProcessManager(execClient);
|
options.executor = new ZfsSshProcessManager(execClient);
|
||||||
|
|
|
||||||
|
|
@ -35,17 +35,17 @@ class ControllerZfsLocalDriver extends ControllerZfsBaseDriver {
|
||||||
return new LocalCliExecClient({
|
return new LocalCliExecClient({
|
||||||
logger: this.ctx.logger,
|
logger: this.ctx.logger,
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getZetabyte() {
|
async getZetabyte() {
|
||||||
return registry.get(`${__REGISTRY_NS__}:zb`, () => {
|
return registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => {
|
||||||
const execClient = this.getExecClient();
|
const execClient = this.getExecClient();
|
||||||
|
|
||||||
const options = {};
|
const options = {};
|
||||||
options.executor = execClient;
|
options.executor = execClient;
|
||||||
options.idempotent = true;
|
options.idempotent = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (
|
if (
|
||||||
this.options.zfs.hasOwnProperty("cli") &&
|
this.options.zfs.hasOwnProperty("cli") &&
|
||||||
|
|
@ -55,7 +55,7 @@ class ControllerZfsLocalDriver extends ControllerZfsBaseDriver {
|
||||||
options.paths = this.options.zfs.cli.paths;
|
options.paths = this.options.zfs.cli.paths;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// use env based paths to allow for custom wrapper scripts to chroot to the host
|
// use env based paths to allow for custom wrapper scripts to chroot to the host
|
||||||
options.paths = {
|
options.paths = {
|
||||||
zfs: "zfs",
|
zfs: "zfs",
|
||||||
|
|
@ -63,13 +63,13 @@ class ControllerZfsLocalDriver extends ControllerZfsBaseDriver {
|
||||||
sudo: "sudo",
|
sudo: "sudo",
|
||||||
chroot: "chroot",
|
chroot: "chroot",
|
||||||
};
|
};
|
||||||
|
|
||||||
options.sudo = _.get(this.options, "zfs.cli.sudoEnabled", false);
|
options.sudo = _.get(this.options, "zfs.cli.sudoEnabled", false);
|
||||||
|
|
||||||
if (typeof this.setZetabyteCustomOptions === "function") {
|
if (typeof this.setZetabyteCustomOptions === "function") {
|
||||||
await this.setZetabyteCustomOptions(options);
|
await this.setZetabyteCustomOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Zetabyte(options);
|
return new Zetabyte(options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1909,7 +1909,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getTrueNASHttpApiClient() {
|
async getTrueNASHttpApiClient() {
|
||||||
return registry.get(`${__REGISTRY_NS__}:api_client`, () => {
|
return registry.getAsync(`${__REGISTRY_NS__}:api_client`, async () => {
|
||||||
const httpClient = await this.getHttpClient();
|
const httpClient = await this.getHttpClient();
|
||||||
return new TrueNASApiClient(httpClient, this.ctx.cache);
|
return new TrueNASApiClient(httpClient, this.ctx.cache);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,12 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getZetabyte() {
|
async getZetabyte() {
|
||||||
return registry.get(`${__REGISTRY_NS__}:zb`, () => {
|
return registry.getAsync(`${__REGISTRY_NS__}:zb`, async () => {
|
||||||
const sshClient = this.getExecClient();
|
const sshClient = this.getExecClient();
|
||||||
const options = {};
|
const options = {};
|
||||||
options.executor = new ZfsSshProcessManager(sshClient);
|
options.executor = new ZfsSshProcessManager(sshClient);
|
||||||
options.idempotent = true;
|
options.idempotent = true;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.options.zfs.hasOwnProperty("cli") &&
|
this.options.zfs.hasOwnProperty("cli") &&
|
||||||
this.options.zfs.cli &&
|
this.options.zfs.cli &&
|
||||||
|
|
@ -49,13 +49,13 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
|
||||||
) {
|
) {
|
||||||
options.paths = this.options.zfs.cli.paths;
|
options.paths = this.options.zfs.cli.paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
options.sudo = _.get(this.options, "zfs.cli.sudoEnabled", false);
|
options.sudo = _.get(this.options, "zfs.cli.sudoEnabled", false);
|
||||||
|
|
||||||
if (typeof this.setZetabyteCustomOptions === "function") {
|
if (typeof this.setZetabyteCustomOptions === "function") {
|
||||||
await this.setZetabyteCustomOptions(options);
|
await this.setZetabyteCustomOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Zetabyte(options);
|
return new Zetabyte(options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -95,19 +95,21 @@ class FreeNASSshDriver extends ControllerZfsBaseDriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
async getHttpClient(autoDetectVersion = true) {
|
async getHttpClient(autoDetectVersion = true) {
|
||||||
const autodetectkey = autoDetectVersion === true ? 1 : 0
|
const autodetectkey = autoDetectVersion === true ? 1 : 0;
|
||||||
return registry.get(`${__REGISTRY_NS__}:http_client:autoDetectVersion_${autodetectkey}`, () => {
|
return registry.getAsync(
|
||||||
const client = new HttpClient(this.options.httpConnection);
|
`${__REGISTRY_NS__}:http_client:autoDetectVersion_${autodetectkey}`,
|
||||||
client.logger = this.ctx.logger;
|
async () => {
|
||||||
|
const client = new HttpClient(this.options.httpConnection);
|
||||||
if (autoDetectVersion && !!!this.options.httpConnection.apiVersion) {
|
client.logger = this.ctx.logger;
|
||||||
const apiVersion = await this.getApiVersion();
|
|
||||||
client.setApiVersion(apiVersion);
|
if (autoDetectVersion && !!!this.options.httpConnection.apiVersion) {
|
||||||
|
const apiVersion = await this.getApiVersion();
|
||||||
|
client.setApiVersion(apiVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
return client;
|
||||||
}
|
}
|
||||||
|
);
|
||||||
return client;
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getDriverShareType() {
|
getDriverShareType() {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,22 @@ class Registry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getAsync(key, initialValue = null) {
|
||||||
|
const val = this.data[key];
|
||||||
|
if (val) {
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof initialValue == "function") {
|
||||||
|
initialValue = await initialValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (initialValue) {
|
||||||
|
this.put(key, initialValue);
|
||||||
|
return this.data[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
delete(key) {
|
delete(key) {
|
||||||
delete this.data[key];
|
delete this.data[key];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue