Skip to content

Commit 51535dd

Browse files
committed
MLE-24763 Removing 'read' module
This was supporting a use case that doesn't exist - having the custom deployer read in the admin username/password. And the custom deployer is in the process of being smoked. One less dependency!
1 parent 762f8e9 commit 51535dd

File tree

4 files changed

+5
-126
lines changed

4 files changed

+5
-126
lines changed

Jenkinsfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,8 @@ def runE2ETests() {
6767
npm --version
6868
npm ci
6969
node etc/test-setup-qa.js
70-
# Adding sleep for the setups to complete before running test-complete
71-
sleep 10
7270
node etc/test-setup-dmsdk-qa.js
73-
sleep 10
7471
node config-optic/setupqa.js
75-
sleep 30
7672
cd test-complete-app
7773
./gradlew -i mlDeploy -g $PWD
7874
cd ..

etc/test-setup-prompt.js

Lines changed: 5 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,13 @@
11
/*
22
* Copyright (c) 2015-2025 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
33
*/
4-
var read = require("read");
5-
var mlutil = require('../lib/mlutil.js');
6-
7-
function adminUserPrompt() {
8-
var self = this;
9-
if (self.user === null) {
10-
read({
11-
prompt: 'admin user (default=admin): '
12-
},
13-
mlutil.callbackOn(self, adminUserCallback)
14-
);
15-
} else {
16-
self.passwordPrompt();
17-
}
18-
}
19-
function adminUserCallback(error, result) {
20-
if (error) {
21-
console.log(error);
22-
process.exit(1);
23-
}
24-
this.user = (result === '') ? 'admin' : result;
25-
this.passwordPrompt();
26-
}
27-
function adminPasswordPrompt() {
28-
var self = this;
29-
if (self.password === null) {
30-
read({
31-
prompt: (self.user === 'admin') ?
32-
'admin password (default=admin): ' : 'admin password: ',
33-
silent: true,
34-
replace: '*',
35-
edit: false
36-
},
37-
mlutil.callbackOn(self, adminPasswordCallback)
38-
);
39-
} else {
40-
self.finish();
41-
}
42-
}
43-
function adminPasswordCallback(error, result) {
44-
if (error) {
45-
console.log(error);
46-
process.exit(1);
47-
}
48-
if (result === '') {
49-
if (this.user === 'admin') {
50-
this.password = 'admin';
51-
} else {
52-
console.log('no admin password specified, so cannot setup');
53-
process.exit(1);
54-
}
55-
} else {
56-
this.password = result;
57-
}
58-
this.finish();
59-
}
60-
function adminFinish() {
61-
this.done(this.user, this.password);
62-
}
63-
64-
function AdminPrompter(done) {
65-
this.done = done;
66-
this.user = null;
67-
this.password = null;
68-
}
69-
AdminPrompter.prototype.userPrompt = adminUserPrompt;
70-
AdminPrompter.prototype.userCallback = adminUserCallback;
71-
AdminPrompter.prototype.passwordPrompt = adminPasswordPrompt;
72-
AdminPrompter.prototype.passwordCallback = adminPasswordCallback;
73-
AdminPrompter.prototype.finish = adminFinish;
4+
// Simplified version - no more prompting, just returns admin/admin
5+
// TODO: Remove this file when ml-gradle migration is complete
746

757
function promptForAdmin(done) {
76-
var prompter = new AdminPrompter(done);
77-
78-
var argvLen = process.argv.length;
79-
if (argvLen >= 4) {
80-
var argvMax = argvLen - 1;
81-
for (var argvI=2; argvI < argvMax; argvI++) {
82-
var argvVal = process.argv[argvI];
83-
if (argvVal === '-u') {
84-
argvVal = process.argv[argvI + 1];
85-
var argvSep = argvVal.indexOf(':');
86-
if (argvSep < 0) {
87-
prompter.user = argvVal;
88-
break;
89-
}
90-
if (argvSep > 0) {
91-
prompter.user = argvVal.substring(0, argvSep);
92-
}
93-
if (argvSep < (argvVal.length - 1)) {
94-
prompter.password = argvVal.substring(argvSep + 1);
95-
}
96-
break;
97-
} else if (argvVal === '-h') {
98-
console.log('usage: '+process.argv[1]+' [-u adminUser:adminPassword]');
99-
console.log('without -u, prompts for admin user and/or admin password');
100-
process.exit();
101-
}
102-
};
103-
}
104-
105-
prompter.userPrompt();
8+
// Always use admin/admin - no prompting needed
9+
console.log('Using default admin credentials (admin/admin)');
10+
done('admin', 'admin');
10611
}
10712

10813
module.exports = promptForAdmin;

package-lock.json

Lines changed: 0 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
"mocha": "^11.7.3",
6161
"mocha-junit-reporter": "2.2.0",
6262
"moment": "^2.29.4",
63-
"read": "^1.0.7",
6463
"sanitize-html": "^2.13.0",
6564
"should": "^13.2.3",
6665
"stream-to-array": "^2.3.0"

0 commit comments

Comments
 (0)