File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313# only trusts the hosts; it does not actually grant access through a
1414# firewall or anything.
1515class nebula::profile::known_host_public_keys {
16- $facts [' ssh' ].each |$name , $key_obj | {
17- $type = $key_obj [" type" ]
18- $key = $key_obj [" key" ]
16+ if $facts [' ssh' ] != undef {
17+ $facts [' ssh' ].each |$name , $key_obj | {
18+ $type = $key_obj [" type" ]
19+ $key = $key_obj [" key" ]
1920
20- @@concat_fragment { "known host ${::networking['fqdn']} ${name}" :
21- tag => ' known_host_public_keys' ,
22- target => ' /etc/ssh/ssh_known_hosts' ,
23- content => " ${::networking['fqdn']} ${type} ${key} \n " ,
21+ @@concat_fragment { "known host ${::networking['fqdn']} ${name}" :
22+ tag => ' known_host_public_keys' ,
23+ target => ' /etc/ssh/ssh_known_hosts' ,
24+ content => " ${::networking['fqdn']} ${type} ${key} \n " ,
25+ }
2426 }
2527 }
2628}
Original file line number Diff line number Diff line change 3030 }
3131 end
3232
33- it { is_expected . to compile }
34-
3533 it "exports an ssh_known_hosts line for its ecdsa key" do
3634 expect ( exported_resources ) . to contain_concat_fragment ( "known host example.invalid ecdsa" )
3735 . with_target ( "/etc/ssh/ssh_known_hosts" )
4644 . with_content ( "example.invalid ssh-rsa rsa_key\n " )
4745 end
4846 end
47+
48+ context "with fqdn of example.invalid and some no ssh public keys" do
49+ let ( :facts ) do
50+ {
51+ networking : {
52+ ip : "0.1.2.3" ,
53+ fqdn : "example.invalid"
54+ } ,
55+ }
56+ end
57+
58+ it { is_expected . to compile }
59+ end
4960 end
5061 end
5162end
You can’t perform that action at this time.
0 commit comments