how to add external fact as hash in puppet 4

asked 2018-09-28 03:54:40 -0500

shajics gravatar image

updated 2018-09-28 07:48:24 -0500

DarylW gravatar image

I want to provide below hash as an external fact

fact_dbmode_array={cdq0232a1 => primary}

when i validate it, it is failing with

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Method call, block parameter 'this_sid' expects a String value, got Integer at /platform/components/dco/db_oracle_psu_patch/0_0_4_shaji/modules/db_oracle_psu_patch/manifests/test.pp:12:17 on node

test code:

$dbmode_hash.each | String $this_sid,  String $dbmode | {
  notify {"DBMODE for ${this_sid} is ${dbmode}":}

ideal result :-

Notice: DBMODE for cdq0232a1 is primary

Any help is really appreciated

edit retag flag offensive close merge delete


I have a couple questions: - is fact_dbmode_array an array or a hash? The name suggests array, as does the error message for iterating dbmode_hash (I think given a block expecting 2 arguments, it gets index then value). The example is a hash. - You talk about an external fact. What generates it?

MichaelSmith gravatar imageMichaelSmith ( 2018-10-01 11:16:55 -0500 )edit