Skip to content

Instantly share code, notes, and snippets.

diff --git a/spec/unit/macaddress_spec.rb b/spec/unit/macaddress_spec.rb
index 638ef2a..8bc26b1 100755
--- a/spec/unit/macaddress_spec.rb
+++ b/spec/unit/macaddress_spec.rb
@@ -49,6 +49,15 @@ describe "macaddress fact" do
proc { Facter.value(:macaddress) }.should_not raise_error
Facter.value(:macaddress).should be_nil
end
+
+ # when ifconfig isn't installed, nil is returned which should be handled gracefully without any
Facter.add(:macaddress) do
confine :kernel => 'Linux'
has_weight 10 # about an order of magnitude faster
setcode do
begin
result = nil
Dir.glob('/sys/class/net/*').each do |path|
mac = File.read(path + "/address").chomp
unless /^(?:00:)+00$|^\s*/.match(mac)
result = mac
@eliasp
eliasp / ldap.py
Last active December 25, 2015 11:19
# -*- coding: utf-8 -*-
'''
Provide authentication using simple LDAP binds
:depends: - ldap Python module
'''
# Import python libs
from __future__ import absolute_import
import logging
@eliasp
eliasp / salt#master.sls
Last active December 27, 2015 20:29
Saltmaster Dockerfiles
python-pip:
pkg.installed
docker-py:
pip.installed:
- require:
- pkg: python-pip
# TODO: ensure docker-py is declared a requirement for all dockerio states without having to explicitely declare the requirement in each container state again
@eliasp
eliasp / docker-volume-cleanup.py
Created November 30, 2013 16:11
A short python script to remove orphaned Docker volumes
#!/usr/bin/python
import json
import os
import shutil
import subprocess
import re
dockerdir = '/var/lib/docker'
volumesdir = os.path.join(dockerdir, 'volumes')
diff -ruN scripts/test/HTMLUtils/LinkQuote.t.orig scripts/test/HTMLUtils/LinkQuote.t
--- scripts/test/HTMLUtils/LinkQuote.t.orig 2013-12-01 16:04:54.920957053 +0000
+++ scripts/test/HTMLUtils/LinkQuote.t 2013-12-01 16:07:08.909366227 +0000
@@ -300,6 +300,14 @@
Name => 'LinkQuote - just TLD given;',
Target => '',
},
+ {
+ Input =>
+ 'http://geizhals.de/?cat=prl&xf=720_LAN+10%2F100~1435_HP~2899_Farblaser~721_Duplexeinheit#xf_top',
@eliasp
eliasp / use-cases.md
Last active January 4, 2016 12:59
Describing some use-cases for hooks in Taskwarrior (task + taskd)

Use cases for hooks in task/taskd

General notes on hooks

While outlining the use-cases below, the following general requirements came up:

RC integration

Each hook should have its own configuration namespace which allows the hook to read its own RC values. Not only root-items should be allowed in the hooks RC, so hooks.hookname.some.thing could be used instead of hooks.hookname.some_thing.

@eliasp
eliasp / ITEMS.md
Last active August 29, 2015 14:01
Updating/improving Saltstack's 'grains'

Listing available grains

  • How does 'grains.ls' build its list?
    • It looks, like it currently simply executes all grain methods and then returns the keys of the resulting dictionary. Simply building the list could be probably done way better, e.g. similar to states/modules returning their virtual name. This would also allow grains to return multiple names for backwards compatibility
@eliasp
eliasp / update.sh
Last active March 30, 2023 16:26
Update SaltStack Minions on Windows
export SALTMASTER="salt.dep.institution.tld"
export SALTVERSION="2014.7.1-AMD64"
export MINIONS="minion-1 minion-2 … minion-n"
for MINION in $(echo ${MINIONS});
do
salt ${MINION} cp.get_url http://docs.saltstack.com/downloads/Salt-Minion-${SALTVERSION}-Setup.exe 'C:\windows\temp\Salt-Minion-'${SALTVERSION}'-Setup.exe'
salt ${MINION} cmd.run shell='powershell' 'C:\windows\temp\Salt-Minion-'${SALTVERSION}'-Setup.exe /S /master='${SALTMASTER}' /minion-name='"${MINION}"
done

Keybase proof

I hereby claim:

  • I am eliasp on github.
  • I am eliasp (https://keybase.io/eliasp) on keybase.
  • I have a public key whose fingerprint is 86A4 F67E 9B33 DD00 E11B F737 82C5 1282 6511 BADB

To claim this, I am signing this object: