Module: EnvironMintModelUtils
- Includes:
- MintLogger
- Defined in:
- src/environmint-model-utils/lib/environmint-model-utils/version.rb,
src/environmint-model-utils/lib/environmint-model-utils/diffjson.rb,
src/environmint-model-utils/lib/environmint-model-utils/jsonutils.rb,
src/environmint-model-utils/lib/environmint-model-utils/model_object.rb,
src/environmint-model-utils/lib/environmint-model-utils/rulesengine.rb
Overview
MintPress® - Automation and Configuration Management Platform
Copyright © 2018 LimePoint. All rights reserved.
This program and its contents are confidential and owned by LimePoint.
Only licenced users are permitted to access and use of this file.
This program (or any part of it) may not be disclosed, copied or used
except as expressly permitted in LimePoint’s End User Licence Agreement.
LimePoint® and MintPress® are Registered Trademarks of LimePoint
For more information contact LimePoint at [http://www.limepoint.com]
Defined Under Namespace
Classes: MintModel
Constant Summary collapse
- VERSION =
'316.1.20241209'.freeze
Constants included from MintLogger
MintLogger::DEBUG, MintLogger::ERROR, MintLogger::FATAL, MintLogger::INFO, MintLogger::UNKNOWN, MintLogger::VERBOSE, MintLogger::WARN
Instance Method Summary collapse
- #advmatch?(pattern, string, use_implied: false) ⇒ Boolean
- #advmatch_resolved?(pattern, string, fulldata, noclone: false, use_implied: false) ⇒ Boolean
-
#apply_businessrules(jsondata, specs, platform) ⇒ Object
this is a 1:1 port from the old python code, with some functionality added for syntactic niceness and flavour.
- #check_for_null!(json_data) ⇒ Object
-
#cleanup_combined_config!(domain, type, source_vals, dest_vals) ⇒ Object
This function is the special case cleanup for startup parameters and classpaths - specifically, we only clean up whole servers worth.
- #cleanup_resource_attributes!(source_in, dest_in, type: 'attributes') ⇒ Object
- #cleanup_resource_params!(source_in, dest_in) ⇒ Object
- #cleanup_unreferenced!(jsondata, remove_domain: false, remove_cluster: false, remove_servers: []) ⇒ Object
- #collapse_properties!(jdata, fulldata: nil, seperate_targets: false, is_otd: false) ⇒ Object
- #convert_to_remote_stage!(jdata) ⇒ Object
-
#create_hash_tree(jdata, dotted_notation, fulldata: nil, tree_is_listitem: true) ⇒ Object
This will _always_ create hashes, be forewarned! NOTE - The current logic adds element in the format "name":"mykey" to arrays To hashes, sub elements are added in the format "name": {}.
- #dedupe_model!(testData) ⇒ Object
-
#diff_model!(source, baseline) ⇒ Object
This is the main entrypoint for comparing a model to a baseline, and spitting out a json on the other side!.
- #expand_hash_properties!(jdata, always_expand: false) ⇒ Object
- #expand_properties!(jdata, fulldata: nil, both_types: false, seperate_targets: true, dedupe_only: false, always_expand: false, is_otd: false) ⇒ Object
- #fancy_decrypt(string) ⇒ Object
- #find_ancestor(object, fulldata) ⇒ Object
-
#find_config_peer(source, dest, config_id) ⇒ Object
Find a config list item which mathces our source.
-
#find_resource(name, from) ⇒ Object
Find an item from the resourceList.
- #find_tree_data(key, jdata, tree_path: "", fulldata: nil, from_key: [], force_attribute: false, orig_data: nil, linkdata: nil) ⇒ Object
-
#genCertTransfer(jsondata, certlist, hostcert, keyalias, passwordlist, stageDir, trustcert) ⇒ Object
FIXME: allow get from passwordvault...
- #generic_method_missing(json_data, full_data, sym, args, parent, final: false, convention: false, parents: false, cameled: false) ⇒ Object
- #get_combined_config(type, domain, source) ⇒ Object
-
#get_my_keyname(thing, tree, working: [], fulldata: nil) ⇒ Object
this is dumb as hell!.
-
#get_params_peer(source, source_id, dest_in) ⇒ Object
Find a params set inside a resource which matches us.
- #getkey(jdata, key, fulldata: nil, followGroup: true, noclone: true, level: 0, cval: "", noskip: false, use_implied: false, name_only: false) ⇒ Object
- #getkey_resolved(jdata, key, fulldata: nil) ⇒ Object
- #getParamFromResource(resource, fullparam) ⇒ Object
- #getResource(domain, m, c, type, full, propkey, paramkey, targettype: "SERVER", namesuffix: "", extraprops: {}, forcename: nil, jmstargets: '', mintpress_action: nil) ⇒ Object
- #ha_adminserver_config(jsondata, floating_server_listen, floating_nodemanager_listen, floating_ssh_address) ⇒ Object
- #int(foo) ⇒ Object
- #is_same_key?(a, b, fulldata, noclone: true, use_implied: false) ⇒ Boolean
- #json_is_obsolete?(json_data, report_type: 'ERROR') ⇒ Boolean
- #len(foo) ⇒ Object
- #nodenum(oldname, host_list, base_host_list: nil) ⇒ Object
- #numeric?(lookAhead) ⇒ Boolean
- #prop_escape(v) ⇒ Object
- #prop_unescape(v) ⇒ Object
- #propgroup_is_from_otd(pgroup_name, jdata) ⇒ Object
- #replace!(jdata, src, dst, fulldata: nil) ⇒ Object
- #replacepartial!(jdata, src, dst, fulldata: nil) ⇒ Object
- #resolve_fnmatch_hash(h, obj) ⇒ Object
- #resolve_grouprefs!(jdata, fulldata: nil) ⇒ Object
- #resolve_introspections!(jdata, fulldata: nil, decrypt: false, seperate_targets: true) ⇒ Object
-
#resolve_single!(jdata, fulldata, linkdata: nil, log_changes: true) ⇒ Object
The regexes here are helped by http://stackoverflow.com/questions/19486686/recursive-nested-matching-pairs-of-curly-braces-in-ruby-regex because they need to handle the substring case!.
-
#resolveInternal(real_instring, localVars) ⇒ Object
goes in jsonutils.rb.
- #resolveInternalFull(real_instring, localVars, linkdata: nil, noclone: false) ⇒ Object
- #resolvereplace!(jdata, src, dst, fulldata: nil) ⇒ Object
- #resolvereplacepartial!(jdata, src, dst, fulldata: nil) ⇒ Object
- #scaleout!(jsondata, hashnodes, hashnodesperhost, port_increment, seperate_admin, host_list, base_host_list: nil, dedicated_admin_node: false, node_filter: nil, system_components_per_host: 1, system_components: nil, allow_scaledown: false, scaledown_removes: false, use_binarysync: false, scale_otd: false, port_increment_step: 1) ⇒ Object
- #set_hash_property!(jdata, propname, value) ⇒ Object
- #snake_to_camel(str) ⇒ Object
- #str(foo) ⇒ Object
- #to_dotted_hash(hash, recursive_key = "") ⇒ Object
- #updatedup(dupname) ⇒ Object
-
#updatenode(oldname, node, host_list, base_host_list: nil, splitchars: nil, returnid: false) ⇒ Object
Right now, this assumes that you're giving it a single node configuration ONLY.
- #updateProperty!(jsondata, key, name, target, ivalue, fulldata: nil, resolved: false, only_existing: false, only_nonexisting: false, force_attribute: false, noskip: false) ⇒ Object
- #validate_json(json_data) ⇒ Object
- #validate_types(json_data) ⇒ Object
Methods included from MintLogger::Utils::Common
#boolean_val, #has_value?, #no_value?, #nvl, #path_as_symbol, #ruby_level_to_send
Instance Method Details
#advmatch?(pattern, string, use_implied: false) ⇒ Boolean
#advmatch_resolved?(pattern, string, fulldata, noclone: false, use_implied: false) ⇒ Boolean
#apply_businessrules(jsondata, specs, platform) ⇒ Object
this is a 1:1 port from the old python code, with some
functionality added for syntactic niceness and flavour.
it needs to be replaced with something more... rubyish...
but for now it will get the job done, which is what I need
#check_for_null!(json_data) ⇒ Object
#cleanup_combined_config!(domain, type, source_vals, dest_vals) ⇒ Object
This function is the special case cleanup for startup parameters and classpaths - specifically, we
only clean up whole servers worth. We deal with cluster targetted ones by deconstructing the cluster - so if only
server2 has changed, we only apply that one
#cleanup_resource_attributes!(source_in, dest_in, type: 'attributes') ⇒ Object
#cleanup_resource_params!(source_in, dest_in) ⇒ Object
#cleanup_unreferenced!(jsondata, remove_domain: false, remove_cluster: false, remove_servers: []) ⇒ Object
#collapse_properties!(jdata, fulldata: nil, seperate_targets: false, is_otd: false) ⇒ Object
#convert_to_remote_stage!(jdata) ⇒ Object
#create_hash_tree(jdata, dotted_notation, fulldata: nil, tree_is_listitem: true) ⇒ Object
This will _always_ create hashes, be forewarned!
NOTE - The current logic adds element in the format "name":"mykey" to arrays
To hashes, sub elements are added in the format "name": {}
#dedupe_model!(testData) ⇒ Object
#diff_model!(source, baseline) ⇒ Object
This is the main entrypoint for comparing a model to a baseline,
and spitting out a json on the other side!
#expand_hash_properties!(jdata, always_expand: false) ⇒ Object
#expand_properties!(jdata, fulldata: nil, both_types: false, seperate_targets: true, dedupe_only: false, always_expand: false, is_otd: false) ⇒ Object
#fancy_decrypt(string) ⇒ Object
#find_ancestor(object, fulldata) ⇒ Object
#find_config_peer(source, dest, config_id) ⇒ Object
Find a config list item which mathces our source
#find_resource(name, from) ⇒ Object
Find an item from the resourceList
#find_tree_data(key, jdata, tree_path: "", fulldata: nil, from_key: [], force_attribute: false, orig_data: nil, linkdata: nil) ⇒ Object
#genCertTransfer(jsondata, certlist, hostcert, keyalias, passwordlist, stageDir, trustcert) ⇒ Object
FIXME: allow get from passwordvault...
use the class for that!!
#generic_method_missing(json_data, full_data, sym, args, parent, final: false, convention: false, parents: false, cameled: false) ⇒ Object
#get_combined_config(type, domain, source) ⇒ Object
#get_my_keyname(thing, tree, working: [], fulldata: nil) ⇒ Object
this is dumb as hell!
#get_params_peer(source, source_id, dest_in) ⇒ Object
Find a params set inside a resource which matches us
#getkey(jdata, key, fulldata: nil, followGroup: true, noclone: true, level: 0, cval: "", noskip: false, use_implied: false, name_only: false) ⇒ Object
#getkey_resolved(jdata, key, fulldata: nil) ⇒ Object
#getParamFromResource(resource, fullparam) ⇒ Object
#getResource(domain, m, c, type, full, propkey, paramkey, targettype: "SERVER", namesuffix: "", extraprops: {}, forcename: nil, jmstargets: '', mintpress_action: nil) ⇒ Object
#ha_adminserver_config(jsondata, floating_server_listen, floating_nodemanager_listen, floating_ssh_address) ⇒ Object
#int(foo) ⇒ Object
#is_same_key?(a, b, fulldata, noclone: true, use_implied: false) ⇒ Boolean
#json_is_obsolete?(json_data, report_type: 'ERROR') ⇒ Boolean
#len(foo) ⇒ Object
#nodenum(oldname, host_list, base_host_list: nil) ⇒ Object
#numeric?(lookAhead) ⇒ Boolean
#prop_escape(v) ⇒ Object
#prop_unescape(v) ⇒ Object
#propgroup_is_from_otd(pgroup_name, jdata) ⇒ Object
#replace!(jdata, src, dst, fulldata: nil) ⇒ Object
#replacepartial!(jdata, src, dst, fulldata: nil) ⇒ Object
#resolve_fnmatch_hash(h, obj) ⇒ Object
#resolve_grouprefs!(jdata, fulldata: nil) ⇒ Object
#resolve_introspections!(jdata, fulldata: nil, decrypt: false, seperate_targets: true) ⇒ Object
#resolve_single!(jdata, fulldata, linkdata: nil, log_changes: true) ⇒ Object
The regexes here are helped by
http://stackoverflow.com/questions/19486686/recursive-nested-matching-pairs-of-curly-braces-in-ruby-regex
because they need to handle the substring case!
#resolveInternal(real_instring, localVars) ⇒ Object
goes in jsonutils.rb
#resolveInternalFull(real_instring, localVars, linkdata: nil, noclone: false) ⇒ Object
#resolvereplace!(jdata, src, dst, fulldata: nil) ⇒ Object
#resolvereplacepartial!(jdata, src, dst, fulldata: nil) ⇒ Object
#scaleout!(jsondata, hashnodes, hashnodesperhost, port_increment, seperate_admin, host_list, base_host_list: nil, dedicated_admin_node: false, node_filter: nil, system_components_per_host: 1, system_components: nil, allow_scaledown: false, scaledown_removes: false, use_binarysync: false, scale_otd: false, port_increment_step: 1) ⇒ Object
#set_hash_property!(jdata, propname, value) ⇒ Object
#snake_to_camel(str) ⇒ Object
#str(foo) ⇒ Object
#to_dotted_hash(hash, recursive_key = "") ⇒ Object
#updatedup(dupname) ⇒ Object
#updatenode(oldname, node, host_list, base_host_list: nil, splitchars: nil, returnid: false) ⇒ Object
Right now, this assumes that you're giving it a single node
configuration ONLY. Also, the servers MUST be named
blach1. Any not matching this standard will be dropped
on the floor!
also, it assumes that the ONLY digits are the node ID. Obviously,
this could break in all sorts of corner cases... but frankly
I'm le tired, and I don't like the approch the old convertToMultinode.py
took anymore. So I'm doing this as a reimplementation the other
way up now.