Navigation Menu

Skip to content

Commit

Permalink
Initial import of stub for install script.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanBUK authored and dvbportal committed Jul 31, 2011
1 parent 53c44c2 commit ef91c3d
Show file tree
Hide file tree
Showing 11 changed files with 958 additions and 0 deletions.
31 changes: 31 additions & 0 deletions bin/install.js
@@ -0,0 +1,31 @@
#!/usr/bin/env node

var nodeControl = require('../deps/node-control/index.js');
var util = require('util');
var ins = util.inspect;
var config = { user: process.env.USER };

var print_lines_prefix = function (prefix, lines) {
var i = 0, l = lines.length;
for(i = 0; i < l; i++) {
if (i < (l - 1) || lines[i].length > 0) console.log('%s: %s', prefix, lines[i]);
}
}

var hosts = nodeControl.hosts(config, ['node01', 'node02', 'node03', 'node04']);
var l = hosts.length,
i = 0;
for(i = 0; i < l; i++) {
(function () {

var my_i = i;
var my_host = hosts[my_i];
my_host.ssh('hostname -s', my_host.address, function (err, stdout, stderr) {
if (err) {
console.error('host %d error: %s', my_i, err.toString());
}
if (stdout.length > 0) print_lines_prefix(my_host.address, stdout.split('\n'));
if (stderr.length > 0) print_lines_prefix(my_host.address + ' ERROR: ', stderr.split('\n'));
});
})();
}
25 changes: 25 additions & 0 deletions deps/node-control/CHANGELOG
@@ -0,0 +1,25 @@
0.1.9
- Init scpOptions as array if not configured so later logic can assume array
- Document and add example of hosts() usage without tasks system

0.1.8
- Add exit callbacks to host.ssh(), host.scp() for handling non-zero exit codes
- Add scpOptions (like sshOptions)
- Add config tasks command line arguments rewriting

0.1.7
- Add host.logMask to allow masking things like passwords from command logging

0.1.6
- Document sshOptions and reimplement to allow setting in config or host object
- Remove undocumented host() method for setting up a single host from config
- Add engines specfication to package.json for node >=0.1.99

0.1.5
- Remove errant console.log statement in ssh command
- Log commands before launching subprocess instead of after

0.1.4
- Add sshOptions to host config to allow passing options to ssh on ssh()
- Add -r flag to scp() invocations to make useful for both files and directories
- Tighten permissions on log file so readable only to local control user
19 changes: 19 additions & 0 deletions deps/node-control/LICENSE
@@ -0,0 +1,19 @@
Copyright (c) 2010 Thomas Smith <node@thomassmith.com> (MIT License)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

0 comments on commit ef91c3d

Please sign in to comment.