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 / ticketmatch.rb
Created March 13, 2014 01:05
Script to match puppet tickets from git log with list from jira
# This script mangles the output from git log between two git references
# and matches this with a list of tickets from Jira.
#
# The List from Jira can be obtained by showing the list of issues for a release
# i.e. a query like this for the given release which gets all targeting the
# release in question:
#
# project = PUP AND fixVersion = "3.5.0" ORDER BY key ASC
#
# Then removing all columns from the output except key.
@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 / paths_between.rb
Last active August 9, 2016 19:04
This is a puppet function that expands two paths to an array of all discrete paths from, to. It is somewhat tested.
Puppet::Parser::Functions.newfunction( :paths_between, :type => :rvalue,
:arity => 2,
:doc => "Produces an array with all paths starting with the first given path to the last.
The intended use is to create an array that is used as the title of a file resource that ensure that
the list of directories exist, are given the wanted mode and ownership."
) do |args|
func_name = "paths_between():"
from = args[0]
to = args[1]
unless to.is_a?(String) && from.is_a?(String)
@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