Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dead code #306

Open
wants to merge 3 commits into
base: v2.x/staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions bin/init/workspace-init.sh

This file was deleted.

75 changes: 0 additions & 75 deletions lib/initInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const argParser = require('../../zlux-server-framework/utils/argumentParser');
const mergeUtils = require('../../zlux-server-framework/utils/mergeUtils');
const yamlConfig = require('../../zlux-server-framework/utils/yamlConfig');
const initUtils = require('./initUtils');
//const upgradeInstance = require('./upgradeInstance');
const os = require('os');
const { execSync } = require('child_process');

Expand All @@ -35,10 +34,6 @@ const workspaceLocation = config.zowe && config.zowe.workspaceDirectory
: process.env.ZWE_zowe_workspaceDirectory;
const destination = path.join(workspaceLocation, 'app-server');

const versionLocation = path.join(destination, 'component.json');



config.productDir = path.join(__dirname, '..', 'defaults');

//Begin generate any missing folders
Expand Down Expand Up @@ -80,33 +75,6 @@ if (!config.pluginsDir) {

fs.mkdirSync(config.pluginsDir, {mode: initUtils.FOLDER_MODE, recursive: true});

function generateComponentJson() {
let componentJsonContent;
try {
componentJsonContent = require(versionLocation);
} catch (e) {
componentJsonContent = {};
//doesnt exist, create new
}
let currentManifestJson;
try {
currentManifestJson = fs.readFileSync(path.join(__dirname, "../../../../../manifest.json"));
} catch (e) {
if (e.code == 'ENOENT') {
// createJson = true;
} else {
console.log('Warning: Could not read manifest.json, error='+e.message);
}
}
try {
componentJsonContent.version = currentManifestJson.version;
} catch (e) {
console.log('Warning: Could not read version from manifest.json, error='+e.message);
componentJsonContent.version = "0.0.0.0";
}
fs.writeFileSync(versionLocation, JSON.stringify(componentJsonContent));
}


function getPluginJsonNames() {
try {
Expand Down Expand Up @@ -147,54 +115,11 @@ if (siteStorage.length == 0 && instanceStorage.length == 0) {
console.warn('ZWED5005W - Warning: error while copying plugin preferences into instance',err);
process.exit(1);
}
generateComponentJson()
process.exit(0);
});
} else {
execSync("cp -r "+path.join(config.productDir, 'ZLUX', 'pluginStorage')+" "+path.join(config.instanceDir, 'ZLUX'));
execSync("chmod -R 770 "+instancePluginStorage);
generateComponentJson()
process.exit(0);
}
}

// TODO: Upgrade logic for v2 needs to be reworked
// /*
// Upgrade logic: If instance contains code from an older version that needs updating, apply the change here.
// */
// try {
// let serverConfig = currentJsonConfig ? jsonUtils.readJSONStringWithComments(currentJsonConfig, 'server.json'): undefined;
// let fromVersion;
// try {
// fromVersion = process.env.ZOWE_UPGRADE_VERSION ? process.env.ZOWE_UPGRADE_VERSION : require(versionLocation).version;
// } catch (e) {
// //pre 1.11
// fromVersion = "1.10.99";
// }
// if (serverConfig) {
// //upgrades based on what WAS there, not what we added above
// const result = upgradeInstance.doUpgrade(fromVersion, destination, serverConfig, instanceItems);
// if (result) {
// let componentJsonContent;
// try {
// componentJsonContent = require(versionLocation);
// } catch (e) {
// componentJsonContent = {};
// //doesnt exist, create new
// }
// componentJsonContent.version = result.upgradedTo;
// fs.writeFileSync(versionLocation, JSON.stringify(componentJsonContent));
// if (result.serverConfig) {
// fs.writeFileSync(path.join(destination, 'serverConfig', 'server.json'), JSON.stringify(result.serverConfig,null,2));
// }
// if (fromVersion != result.upgradedTo) {
// initUtils.registerBundledPlugins(config.pluginsDir, instancePluginStorage, instanceItems, initUtils.FILE_MODE);
// }
// } else {
// console.log("Could not perform app-server upgrade");
// process.exit(1);
// }
// }
// } catch (e) {
// //skip process
// }
26 changes: 0 additions & 26 deletions lib/initUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,29 +128,3 @@ module.exports.setTerminalDefaults = function(configDestination, instanceItems)
}
}
}

/* Warning: This function is unused and the way it works is subject to change */
module.exports.getLastZoweRoot = function(workspaceLocation) {
try {
const backupsDirContent = fs.readdirSync(path.join(workspaceLocation, 'backups'));
if (backupsDirContent.length == 0) {return null;}
let lastBackup = backupsDirContent[0];
backupsDirContent.forEach((backup)=> {
if (backup > lastBackup) {
lastBackup = backup;
}
});
const lines = fs.readFileSync(path.join(workspaceLocation, 'backups', lastBackup),'utf8').split('\n');
for (let i = 0; i < lines.length; i++) {
if (lines[i].startsWith('ROOT_DIR=')) {
/*ex: ROOT_DIR=/opt/zowe/zowe-1.11.0 */
return lines[i].substr(9);
}
}
} catch (e) {
console.warn('Could not read workspace backup directory, previous Zowe version unknown');
return null;
}
return null;//dev environment with no env files in backups?
}

243 changes: 0 additions & 243 deletions lib/upgradeInstance.js

This file was deleted.

Loading