Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
lovelace
webLovelace
Commits
5ae89d99
Commit
5ae89d99
authored
Mar 02, 2017
by
Alejandro E. Rendon
Browse files
Testing new users in slave nodes
parent
a729bea0
Changes
2
Hide whitespace changes
Inline
Side-by-side
controllers/admin.js
View file @
5ae89d99
...
...
@@ -105,9 +105,10 @@ exports.new = (req, res) => {
res
.
redirect
(
'
/
'
);
}
else
{
sshKey
(
user
,
err
=>
{
if
(
err
)
if
(
err
)
{
console
.
log
(
err
);
else
{
res
.
redirect
(
'
/
'
);
}
else
{
// res.redirect('/admin/users');
createUserCluster
(
uid
,
user
,
err
=>
{
if
(
err
)
{
...
...
helpers/user.js
View file @
5ae89d99
...
...
@@ -95,31 +95,33 @@ exports.createUser = (uid, user, callback) => {
exports
.
createUserCluster
=
(
uid
,
username
,
callback
)
=>
{
const
{
user
,
password
,
nodes
}
=
config
.
cluster
;
const
path
=
`useradd -u
${
uid
}
-g adm -g cdrom -g dip -g plugdev -g lpadmin -g sambashare -d /homeshare/
${
user
.
username
}
-s /bin/bash -m
${
user
.
username
}
`
;
const
path
=
`useradd -u
${
uid
}
-g adm -g cdrom -g dip -g plugdev -g lpadmin -g sambashare -d /homeshare/
${
username
.
username
}
-s /bin/bash -m
${
username
.
username
}
`
;
const
passPath
=
'
echo
'
+
username
.
username
+
'
:
'
+
decrypt
(
username
.
linux
)
+
'
| sudo chpasswd
'
;
let
report
=
[];
for
(
node
in
nodes
)
{
console
.
log
(
node
);
let
ssh
=
new
SSH
({
host
:
node
,
user
:
user
,
user
:
node
,
pass
:
password
});
ssh
.
exec
(
path
Key
,
{
.
exec
(
path
,
{
err
:
stderr
=>
{
if
(
err
)
{
console
.
log
(
node
);
report
.
push
(
node
);
}
else
{
// createUser(uid, username, err => {
// if (err) {
// return callback(err);
// }
// callback();
// });
}
}
})
.
exec
(
pathKey
,
{})
.
start
();
}
callback
(
report
);
...
...
@@ -128,7 +130,7 @@ exports.createUserCluster = (uid, username, callback) => {
exports
.
sshKey
=
(
user
,
callback
)
=>
{
const
ssh
=
new
SSH
({
host
:
'
localhost
'
,
//
port: 4000,
port
:
4000
,
user
:
user
.
username
,
pass
:
decrypt
(
user
.
linux
)
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment