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
@hlindberg
hlindberg / meeting-policy.md
Created February 20, 2014 16:02
Stockholm DevOps Meeting Policy

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 March 12, 2014 21:06
Puppet 3.5.0 log / issue review
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 August 29, 2015 13:57
An assert_type function for puppet (untested example)
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 August 29, 2015 13:58
ducks in a row - puppet
define duck($name) {
notice "duck $name"
include c
}
class c {
notice 'in c'
duck { 'duck0': name => 'mc scrooge' }
}
@hlindberg
hlindberg / carmodel.rb
Created April 29, 2014 17:12
Small sample RGen model
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
@hlindberg
hlindberg / carmodel2.rb
Created May 1, 2014 16:07
Sample RGen model
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"
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
class fruit {
Notify { message => 'banana default'}
define banana {
notify { "in banana $title": }
}
tag 'yellow'
define another {
notify { "in another $title": }
}
fruit::banana { fruit1: }
<<<<<<< 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 }]