You want to test a resource definition (class, defined type) that uses a function provided by a third-party module your module depends upon.
It's supposed that you're implementing your tests with rspec-puppet.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Bind SSL port with PFS-enabling cipher suite | |
| bind :443 ssl crt path_to_certificate no-tls-tickets ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-RSA-RC4-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES128-SHA:AES256-SHA256:AES256-SHA:RC4-SHA | |
| # Distinguish between secure and insecure requests | |
| acl secure dst_port eq 443 | |
| # Mark all cookies as secure if sent over SSL | |
| rsprep ^Set-Cookie:\ (.*) Set-Cookie:\ \1;\ Secure if secure | |
| # Add the HSTS header with a 1 year max-age |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| dn='dc=math,dc=nccu,dc=edu,dc=tw' | |
| username='jim.yeh' | |
| uid='jim.yeh' | |
| gid='student' | |
| cat << EOF > user_example.ldif | |
| dn: cn=$username,ou=users,ou=login,$dn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Autostart Libvirt VM's created with Foreman | |
| # /usr/share/foreman/config/hooks/host/managed/create/10_autostart_libvirt.sh | |
| # Source: http://www.uberobert.com/autostart-libvirt-vms-in-foreman/ | |
| . $(dirname $0)/hook_functions.sh | |
| username='admin' | |
| password='changeme' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| input { | |
| file { | |
| path => "/root/mult.log" | |
| start_position => "beginning" | |
| sincedb_path => "/dev/null" | |
| codec => multiline{ | |
| pattern => "^ -%{SPACE}%{TIMESTAMP_ISO8601}" | |
| negate => true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Failure/Error: let(:contents) { param_value(catalogue, 'concat::fragment', 'haproxy-base', 'content').split("\n") } | |
| Puppet::Error: | |
| Could not parse for environment production: Syntax error at ':'; expected '}' at line 4 on node foo.example.com | |
| # ./vendor/bundle/ruby/2.1.0/gems/puppet-3.7.5/lib/puppet/parser/parser_support.rb:157:in `on_error' | |
| # ./vendor/bundle/ruby/2.1.0/gems/puppet-3.7.5/lib/puppet/parser/lexer.rb:501:in `scan' | |
| # ./vendor/bundle/ruby/2.1.0/gems/puppet-3.7.5/lib/puppet/parser/parser_support.rb:168:in `parse' | |
| # ./vendor/bundle/ruby/2.1.0/gems/puppet-3.7.5/lib/puppet/node/environment.rb:545:in `perform_initial_import' | |
| # ./vendor/bundle/ruby/2.1.0/gems/puppet-3.7.5/lib/puppet/node/environment.rb:276:in `known_resource_types' | |
| # ./vendor/bundle/ruby/2.1.0/gems/puppet-3.7.5/lib/puppet/resource/type_collection_helper.rb:5:in `known_resource_types' | |
| # ./vendor/bundle/ruby/2.1.0/gems/puppet-3.7.5/lib/puppet/parser/compiler.rb:558:in `block in initvars' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| global | |
| chroot /var/lib/haproxy | |
| crt-base /etc/pki/tls/certs | |
| daemon | |
| group haproxy | |
| log 127.0.0.1 local0 | |
| maxconn 2000 | |
| pidfile /var/run/haproxy.pid | |
| stats socket /var/lib/haproxy/stats | |
| tune.ssl.default-dh-param 2048 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'erb' | |
| require 'json' | |
| require 'optparse' | |
| require 'ostruct' | |
| class ERBContext | |
| def initialize(hash) | |
| raise ArgumentError, 'hash must be a Hash object' unless hash.is_a?(::Hash) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This file managed by Puppet | |
| global | |
| chroot /var/lib/haproxy | |
| daemon | |
| group haproxy | |
| log 127.0.0.1 local1 info | |
| log-send-hostname | |
| maxconn 4096 | |
| stats socket /var/lib/haproxy/admin.sock mode 660 level admin | |
| stats socket /var/lib/haproxy/user.sock mode 666 level user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Puppet::Functions.create_function(:file_lookup_key) do | |
| dispatch :file_lookup_key do | |
| param 'String[1]', :key | |
| param 'Hash[String[1],Any]', :options | |
| param 'Puppet::LookupContext', :context | |
| end | |
| def file_lookup_key(key, options, context) | |
| # Set interpolate = true by default and override it with the value of | |
| # options['interpolate'], if set. |