Skip to content

Instantly share code, notes, and snippets.

View hlindberg's full-sized avatar

Henrik Lindberg hlindberg

  • Bebalon Ltd
  • Għarb, Gozo, Malta
  • X @hel
View GitHub Profile
class fruit {
Notify { message => 'banana default'}
define banana {
notify { "in banana $title": }
}
tag 'yellow'
define another {
notify { "in another $title": }
}
fruit::banana { fruit1: }
@hlindberg
hlindberg / fizzbuzz.pp
Last active July 9, 2020 23:31
FizzBuzz in Puppet 4.1
notice Integer[0,99].map |$x| {
case [$x % 3, $x % 5] {
[0, 0] : { fizzbuzz }
[0, default] : { fizz }
[default, 0] : { buzz }
default : { $x }
}
}
<<<<<<< HEAD
it 'should exit with 0 when -assert equal is used and catalogs are equal due to exclude' do
env_path = File.join(testdir_simple, 'environments')
on master, puppet("preview --preview_environment compliant --assert equal --excludes #{testdir_simple}/files/excludes.json --migrate 3.8/4.0 #{node_names_cli.join(' ')} --nodes #{node_names_filename} --environmentpath #{env_path}"),
:acceptable_exit_codes => [0]
end
=======
context 'when using --assert equal with --excludes' do
it 'should exit with 0 when excluding attributes qualified with type, title, and attribute name' do
env_path = File.join(testdir_simple, 'environments')
Load Balancer Example
---
The first part - ChangeRequest is a generic plan that holds on to a set of values
of type T (given when plan is instantiated), and emits the changed set whenever it
changes.
~~~
type AddRemove = Enum['add', 'remove']
type ChangeRequest[T] = Struct[{'kind' => AddRemove, 'value' => T }]
@hlindberg
hlindberg / gist:660cfacf68860c1ae96d
Created July 14, 2015 17:42
load balanser in honeydew with $ variables

Load Balancer Example (puppetized)

The first part - ChangeRequest is a generic plan that holds on to a set of values of type T (given when plan is instantiated), and emits the changed set whenever it changes.

type AddRemove = Enum['add', 'remove']
type ChangeRequest[T] = Struct[{'kind' =&gt; AddRemove, 'value' =&gt; T }]
@hlindberg
hlindberg / gist:ef417f3fb8778740f2a2
Last active August 29, 2015 14:24
Load balancer in Honeydew - $ for variables, no $ for queues

Load Balancer Example (puppetized)

The first part - ChangeRequest is a generic plan that holds on to a set of values of type T (given when plan is instantiated), and emits the changed set whenever it changes.

type AddRemove = Enum['add', 'remove']
type ChangeRequest[T] = Struct[{'kind' =&gt; AddRemove, 'value' =&gt; T }]
---
packaging_url: 'git://github.com/puppetlabs/packaging.git --branch=master'
packaging_repo: 'packaging'
default_cow: 'base-squeeze-i386.cow'
cows: 'base-CumulusLinux-2.2-amd64.cow base-lucid-i386.cow base-precise-i386.cow base-squeeze-i386.cow base-trusty-i386.cow base-wheezy-i386.cow'
pbuild_conf: '/etc/pbuilderrc'
packager: 'puppet'
gpg_name: 'info@puppetlabs.com'
gpg_key: '4BD6EC30'
sign_tar: FALSE
@hlindberg
hlindberg / honedew_load_balancer.md
Created November 19, 2015 21:08
Honeydew Actor Load Balancer

Load Balancer Example (puppetized)

The first part - ChangeRequest is a generic actor that holds on to a set of values of type T (given when actor is instantiated), and emits the changed set whenever it changes.

type AddRemove = Enum['add', 'remove']
type ChangeRequest[T] = Struct[{'kind' =&gt; AddRemove, 'value' =&gt; T }]
#! /usr/bin/env ruby
require 'spec_helper'
require 'puppet'
describe "Puppet::DataProviders::HieraInterpolate" do
context "when there are empty interpolations %{} in data" do
let(:scope) { {} }
let(:lookup_invocation) {
@hlindberg
hlindberg / mismatch.svg
Created February 15, 2016 19:12
A type mismatch svg generated from a dot file
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.