gestalt
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -103,2 +103,5 @@ var gestalt = require('../lib/gestalt'); | ||
}); | ||
} else { | ||
console.log( "I was", change.old_value ); | ||
console.log("Now I have no name."); | ||
} | ||
@@ -153,2 +156,3 @@ }); | ||
console.log("\nJoining cluster: %s", cluster_name); | ||
config.remove("cluster:me"); | ||
@@ -175,4 +179,9 @@ var zk_config = config.get("zk"); | ||
zk_config.zookeeper( function(zk) { | ||
zk_name_me(zk, names_path(), names, function(name) { | ||
config.set("cluster:me",name); | ||
zk_name_me(zk, names_path(), names, function(name,err) { | ||
if( name ) { | ||
config.set("cluster:me",name); | ||
} else { | ||
console.log("Failed to join cluster.\n",err); | ||
process.exit(-1); | ||
} | ||
}); | ||
@@ -188,5 +197,5 @@ }); | ||
zk.a_get_children(dir,false,function(rc,err,children) { | ||
var n1 = _.without(names,children); | ||
var n1 = _.difference(names,children); | ||
if( n1.length == 0) { | ||
throw new Error("unable to get a name"); | ||
cb( null, "Unable to get a name."); | ||
} else { | ||
@@ -305,3 +314,10 @@ var name = n1[ Math.floor( Math.random() * n1.length ) ]; | ||
var setup_exit = function() { | ||
f = function() { process.exit(); } | ||
f = function() { | ||
// Try to gracefully close our zookeeper connection | ||
var zk_config = config.get("zk"); | ||
if( zk_config ) { | ||
zk_config.zookeeper( function(zk) { zk.close(); } ); | ||
} | ||
process.exit(); | ||
}; | ||
process.removeAllListeners('SIGINT'); | ||
@@ -308,0 +324,0 @@ process.on('SIGINT', f ); |
@@ -411,13 +411,32 @@ var EventEmitter = require('events').EventEmitter, | ||
p.report = function (indent) { | ||
p.report = function () { | ||
var self = this; | ||
keys = []; | ||
console.log(); | ||
_.each( this.keys().sort(), function(key) { | ||
var path = self.getPath(key); | ||
var indent = ""; | ||
for(var i=0; i<keys.length && i <path.length && keys[i] == path[i]; ++i) { | ||
indent += " "; | ||
} | ||
for(; i<path.length-1;++i) { | ||
console.log( indent + path[i] + ":" ); | ||
indent += " "; | ||
} | ||
var valSource = self.getValSource(key); | ||
var value = valSource.value; | ||
var source = "# " + valSource.source; | ||
if (value instanceof Configuration) { | ||
value = '[Configuration]'; | ||
} else if ( _.isString(value) ) { | ||
value = "'" + value + "'"; | ||
} | ||
console.log("%s=%s --%s", key, value, valSource.source); | ||
value = ''; | ||
source=''; | ||
} | ||
var out = (indent + path[i] + ": " + value).split(''); | ||
while(out.length < 30) { | ||
out.push(' '); | ||
} | ||
console.log(out.join(''), source); | ||
keys = path; | ||
}); | ||
@@ -424,0 +443,0 @@ }; |
@@ -34,2 +34,9 @@ var fs = require('fs'), | ||
} | ||
// Check for an empty file | ||
if( !_.isObject( object ) ) { | ||
self.state('invalid', self._source_ + " contains no data."); | ||
return; | ||
} | ||
// Iterate through the values in the existing | ||
@@ -36,0 +43,0 @@ // data and remove any that are not defined in the new |
{ | ||
"name": "gestalt", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"author": "Chris Howe <chris@howeville.com>", | ||
@@ -29,3 +29,3 @@ "description": "Event driven configuration management.", | ||
], | ||
"license": "MIT", | ||
"license": "Apache-2.0", | ||
"engine": { | ||
@@ -32,0 +32,0 @@ "node": ">=0.6" |
Sorry, the diff of this file is not supported yet
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
133954
37
2428