Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
if ! which virsh >/dev/null 2>&1; then
exit 0
fi
VIRSH="virsh"
action_snapshot()
{
@sathlan
sathlan / disable-enable-update-on-node.sh
Last active June 14, 2018 12:33
Enable user to avoid update on certain node.
# 1. Create compute-host-to-exclude.txt
# one ip of compute nodes to be excluded from the update by line For
# instance this give the list of all compute node minus one. those
# will be disable, letting only one computed being updated.
# openstack server list -f json | \
# jq -r 'map(select(.Name |contains("compute")))[0:-1] | .[].Networks' \
# | awk -F= '{print $2}' > compute-host-to-exclude.txt
grep 'RESP BODY:' toto.txt | sed -e 's/RESP BODY: *//' | jq '.output | select(. != "{}")' | grep -v '^null$' |jq '. | fromjson | .output' | awk 'BEGIN{end=0};{if(end == 0){print $0}}/^}$/{end=1}'> run0
jq '.stdout' -r run0 > run0.out
grep 'RESP BODY:' toto.txt | sed -e 's/RESP BODY: *//' | jq '.output | select(. != "{}")' | grep -v '^null$' |jq '. | fromjson | .output' | awk 'BEGIN{end=0};{if(end == 1){print $0}}/^}$/{end=1}'> run1
jq '.stdout' -r run1 > run1.out
@sathlan
sathlan / debug-docker-puppet-run.sh
Last active January 25, 2018 09:59
Debug tripleo docker-puppet error.
#!/usr/bin/bash
set -eu
IMAGE="${1:?'Provide a image name'}"
# Next line was first seen used under the magic finger of dciabrin and we shall love him for that forever.
CMD=$(docker inspect --format='{{range .Config.Env}} -e "{{.}}" {{end}} {{range .Mounts}} -v {{.Source}}:{{.Destination}}{{if .Mode}}:{{.Mode}}{{end}}{{end}} -ti {{.Config.Image}}' docker-puppet-${IMAGE} )
echo "Command to use to re-run manually:\ndocker run -u root --net=host ${CMD}\n"
NUMBER_OF_LINES = 51
Date.prototype.addDays = function(days) {
var dat = new Date(this.valueOf());
dat.setDate(dat.getDate() + days);
return dat;
}
function getNextValidDateFrom(addDay) {
var nextValid = new Date().addDays(addDay);
for i in `ironic node-list --maintenance true --field uuid | awk 'NR>3 && $0 ~! /^\+/ {print $2}'`; do ironic node-set-maintenance $i false; done
#!/bin/bash
. stackrc
for failed in $(heat resource-list \
--nested-depth 5 overcloud | grep FAILED |
grep 'StructuredDeployment ' | cut -d '|' -f3)
do heat deployment-show $failed > failed_deployment_$failed.log
done
heat_template_version: 2014-10-16
description: >
Extra config to add swap space to nodes.
# Parameters passed from the parent template - note if you maintain
# out-of-tree templates they may require additional parameters if the
# in-tree templates add a new role.
parameters:
controller_servers:
Modified lib/puppet/provider/mongodb.rb
diff --git a/lib/puppet/provider/mongodb.rb b/lib/puppet/provider/mongodb.rb
index 6bbc350..d82fa83 100644
--- a/lib/puppet/provider/mongodb.rb
+++ b/lib/puppet/provider/mongodb.rb
@@ -55,8 +55,11 @@ class Puppet::Provider::Mongodb < Puppet::Provider
if bindip
first_ip_in_list = bindip.split(',').first
- if first_ip_in_list.eql? '0.0.0.0'
@sathlan
sathlan / faraday_openstack_test.rb
Created October 15, 2015 18:37
Connect to openvstack keystone v3 and make a request using basic faraday.
#!/usr/bin/ruby
require 'faraday'
require 'json'
conn = Faraday.new(:url => 'http://localhost:5000')
responce = conn.post do |post|
post.url '/v3/auth/tokens'
post.headers['Content-Type'] = 'application/json'
post.body = {