Skip to content

Instantly share code, notes, and snippets.

Avatar

Henrik Lindberg hlindberg

  • Bebalon Ltd
  • Għarb, Gozo, Malta
View GitHub Profile
@hlindberg
hlindberg / meeting-policy.md
Created Feb 20, 2014
Stockholm DevOps Meeting Policy
View meeting-policy.md

Stockholm DevOps Meeting Policy

Stockholm DevOps meetings are friendly - everyone is welcome. Should you hesitate because to participate due to fear of harassment, rest assure that we have not had any such incidents and that we, the Stockholm DevOps organizers are dedicated to providing a harassment-free meeting experience for everyone. We do not tolerate harassment of meeting participants in any form. Meeting participants violating these rules may be expelled from the meeting, and speakers may be interrupted and taken off stage at the discretion of the conference organizers.

At any time during a Stockholm DevOps event if you are being harassed, notice that someone else is being harassed, or have any other concerns, please contact one of the organizers or a member of meeting staff immediately.

Stockholm DevOps Organizers

@hlindberg
hlindberg / gist:9516346
Created Mar 12, 2014
Puppet 3.5.0 log / issue review
View gist:9516346
Legend
** = no jira issue targeting 3.5.0
-- = jira issue targeting 3.5.0 (or manually fixed for redmine issues and duplicates)
Git Log per mentioned issue
-- (#16570) a.k.a (PUP-1058)
32b1f61 Don't load the node object again in configurer
-- (#20516) a.k.a (PUP-792) Evaluator
@hlindberg
hlindberg / assert_type.rb
Last active Aug 29, 2015
An assert_type function for puppet (untested example)
View assert_type.rb
Puppet::Parser::Functions::newfunction(:assert_type, :arity => 2, :type => :rvalue, :doc =>
"Asserts that the given value has the given type and returns the value") do |args|
if Puppet::Pops::Types::TypeCalculator.instance?(args[0], args[1])
args[1]
else
raise Puppet::ParseError, "The given value is not of type #{Puppet::Pops::Types::TypeCalculator.string(args[0])}"
end
end
@hlindberg
hlindberg / ducks.pp
Last active Aug 29, 2015
ducks in a row - puppet
View ducks.pp
define duck($name) {
notice "duck $name"
include c
}
class c {
notice 'in c'
duck { 'duck0': name => 'mc scrooge' }
}
@hlindberg
hlindberg / carmodel.rb
Created Apr 29, 2014
Small sample RGen model
View carmodel.rb
require 'rgen/metamodel_builder'
module MyModel
# Let RGen now this module is a model
extend RGen::MetamodelBuilder::ModuleExtension
# An abstract class that makes it easier to check if a given
# object is an element of "MyModel"
#
class MyModelElement < RGen::MetamodelBuilder::MMBase
# We make this class abstract to make it impossible to create instances of it
View carmodel2.rb
require 'puppet'
require 'puppet/pops'
require 'rgen/metamodel_builder'
module MyModel
# Let RGen now this module is a model
extend RGen::MetamodelBuilder::ModuleExtension
# An abstract class that makes it easier to check if a given
# object is an element of "MyModel"
View gist:88fd6c2c0ba5ffd8cf00
Error while evaluating a Method call, function 'each' called with mis-matched arguments
expected one of:
each(Hash[Any, Any] hash, Callable[2, 2] block) - arg count {2}
each(Hash[Any, Any] hash, Callable[1, 1] block) - arg count {2}
each(Any enumerable, Callable[2, 2] block) - arg count {2}
each(Any enumerable, Callable[1, 1] block) - arg count {2}
actual:
each(Tuple[Integer, Integer, Integer, Integer, Integer, Integer, Integer], Callable[Any, Any, Any]) - arg count {2} at line 1:29 on node foonode
View gist:4deac70901fdafe9dbdc
class fruit {
Notify { message => 'banana default'}
define banana {
notify { "in banana $title": }
}
tag 'yellow'
define another {
notify { "in another $title": }
}
fruit::banana { fruit1: }
View gist:2204c50a8a52da112682
<<<<<<< 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')
View gist:67458279cc87a0ed43d3
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 }]