generate host_config_key using random UUIDs, not a time-based md5 hash

This commit is contained in:
Ryan Petrello
2018-11-16 16:45:30 -05:00
committed by kialam
parent d9866c35b4
commit a72f3d2f2f
3 changed files with 8 additions and 7 deletions

View File

@@ -31,7 +31,8 @@ module.exports = {
$: true,
_: true,
codemirror: true,
jsyaml: true
jsyaml: true,
crypto: true
},
rules: {
'arrow-parens': 'off',

View File

@@ -35,7 +35,8 @@
"moment": false,
"spyOn": false,
"jasmine": false,
"dagre": false
"dagre": false,
"crypto": false
},
"strict": false,
"quotmark": false,

View File

@@ -1,5 +1,5 @@
export default
function md5Setup(md5) {
function md5Setup() {
return function(params) {
var scope = params.scope,
master = params.master,
@@ -10,8 +10,9 @@ export default
master[check_field] = default_val;
scope.genMD5 = function (fld) {
var now = new Date();
scope[fld] = md5.createHash('AnsibleWorks' + now.getTime());
scope[fld] = ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
);
scope.$emit('NewMD5Generated');
};
@@ -26,5 +27,3 @@ export default
};
};
}
md5Setup.$inject = [ 'md5' ];