Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#
# purge tables of "deleted" records by archiveing them in sensible chunks to the shadow tables
DATABASE=nova
TABLES="instance_info_caches instance_system_metadata instances reservations compute_node_stats "
for TABLE in ${TABLES}
do
#!/bin/bash
#
# purge tables of "deleted" records by archiveing them in sensible chunks to the shadow tables
# this work was started in PAASINFRA-206
#
DRY_RUN="--dry-run"
unset DRY_RUN
DATABASE=nova
@simonmcc
simonmcc / gist:9483853
Last active August 29, 2015 13:57
DevOps mini bash!
If you want to take part in the hands on component of the DevOps mini bash,
please download & install the following before the event:
VirtualBox: https://www.virtualbox.org/wiki/Downloads
Vagrant: http://www.vagrantup.com/downloads.html
The precise32 box for vagrant: http://files.vagrantup.com/precise32.box
You'll also need a text editor & a web browser you're familiar with.
require 'serverspec'
include Serverspec::Helper::Exec
include Serverspec::Helper::DetectOS
RSpec.configure do |c|
c.before :all do
c.path = '/sbin:/usr/sbin'
end
end
use keystone;
delete from token where expires <= date_sub(now(), interval 3 day);
delimiter ;;
create event if not exists token_flush ON SCHEDULE EVERY 1 DAY
DO delete from token where expires <= date_sub(now(), interval 3 day);
;;
delimiter ;
use nova;
-- only create the index if it doesn't already exist
@simonmcc
simonmcc / -
Last active January 4, 2016 03:49
ruby '1.9.3'
source 'https://rubygems.org'
gem "test-kitchen", '>=1.2.1'
gem "kitchen-vagrant"
gem "unf"
gem "kitchen-salt", ">=0.0.11"
@simonmcc
simonmcc / -
Created October 14, 2013 19:03
diff --git a/beaver.sls b/beaver.sls
index 9dc1f8f..ad2b53d 100644
--- a/beaver.sls
+++ b/beaver.sls
@@ -17,7 +17,7 @@ beaver:
format: json
transport: tcp
tcp_port: 5960
- tcp_host: {% '-'.join(grains['host'].split('-')[:2]) + '-dbhead0001' %}
+ tcp_host: {{ salt['pillar.get']('beaver:logstash_server', '127.0.0.1') }}
@simonmcc
simonmcc / -
Created October 10, 2013 15:04
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#!/bin/bash
#
# Upload that bloody cookbook, even if knife thinks it's not a cookbook
#
abspath () {
case "$1" in
/*)printf "%s\n" "$1";;
*)printf "%s\n" "$PWD/$1";;
esac
}
diff --git a/designate/schema.py b/designate/schema.py
index f813a30..c1c1907 100644
--- a/designate/schema.py
+++ b/designate/schema.py
@@ -109,6 +109,14 @@ class SchemaValidator(jsonschema.Draft3Validator):
if instance == '0.0.0.0': # RFC5735
msg = "%s is not an IPv4 address" % (instance)
yield jsonschema.ValidationError(msg)
+ # is it a dotted quad & all 4 fields <= 255
+ m = re.match('(\d+)\.(\d+)\.(\d+)\.(\d+)$', instance)