Skip to content

Instantly share code, notes, and snippets.

@ajroetker
ajroetker / pubsub_example.go
Created August 21, 2018 19:32
Reproducing the pubsub code
// Copyright 2018 Google LLC
//
// 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,
code-manager : {
file-sync : {
repo-id : "puppet-code"
}
environmentdir : "/etc/puppetlabs/code-staging/environments"
datadir : "/opt/puppetlabs/server/data/code-manager/"
cachedir : "/opt/puppetlabs/server/data/code-manager/cache"
authenticate-webhook : true
deploy-pool-size : 2
timeouts : {
code-manager : {
file-sync : {
repo-id : "puppet-code"
}
environmentdir : "/etc/puppetlabs/code-staging/environments"
datadir : "/opt/puppetlabs/server/data/code-manager/"
cachedir : "/opt/puppetlabs/server/data/code-manager/cache"
authenticate-webhook : true
deploy-pool-size : 2
timeouts : {
@ajroetker
ajroetker / mine.txt
Created April 4, 2017 17:00
lock file for gems
*[2016.4.x][~/Projects/code-manager/test]$ bundle update rvm:ruby-2.3.0
Fetching source index from http://rubygems.delivery.puppetlabs.net/
Resolving dependencies...
Using rake 12.0.0
Using CFPropertyList 2.3.5
Using addressable 2.4.0
Using json 1.8.6
Using mini_portile2 2.1.0
Using hocon 1.2.4
Using require_all 1.3.3
@ajroetker
ajroetker / puppetdb_101.md
Last active May 25, 2016 20:55
How to run and test PuppetDB as a dev

PuppetDB 101

  • Install Java 8
  • Install Brew
    • Install PostgreSQL
    • Install leiningen
  • To run tests:
    • Create test databases and users (follow doc in PuppetDB repo, grep for pdb_test_admin)
    • lein test
  • To run PuppetDB:
@ajroetker
ajroetker / .vimrc
Created September 24, 2013 16:48
This is my vim configuration!
"-----------------------------------------------------------------------
"Andrew's vimrc based on Hunner, BaSS & ciaran
"-----------------------------------------------------------------------
"-----------------------------------------------------------------------
" terminal setup
"-----------------------------------------------------------------------
" {{{1
" Add path for windows
@ajroetker
ajroetker / foo.clj
Created September 28, 2015 20:56
update the wire-format of example reports
(ns foo
(:require [clojure.java.io :as io]
[puppetlabs.puppetdb.reports :as reports]
[puppetlabs.puppetdb.cheshire :as json]))
(defn update-file-contents [file]
[(.getName file)
(json/generate-string
(reports/wire-v5->wire-v6
(json/parse-string
@ajroetker
ajroetker / ur.clj
Created July 17, 2015 18:55
unchanged resources test-data loader
(ns ur
(:require [puppetlabs.puppetdb.examples.reports :as example-reports]
[puppetlabs.kitchensink.core :as kitchensink]
[puppetlabs.puppetdb.scf.storage-utils :as scf-utils]
[clojure.java.jdbc :as jdbc]
[puppetlabs.puppetdb.cheshire :as json]))
(def skeleton-unchanged-resource
{:title "/etc/sysconfig/iptables"
:file "/etc/puppetlabs/code/environments/production/modules/firewall/manifests/linux/redhat.pp"
@ajroetker
ajroetker / state_overview_single_query.sql
Last active August 29, 2015 14:25 — forked from wkalt/gist:856c87c322f1ef75d43c
single query for state-overview example from Wyatt, touched up a little
SELECT (CASE WHEN certnames.latest_report_id IS NULL THEN 'unreported'
/* NOW() would instead be a parameterized value */
WHEN reports.end_time < NOW() - interval '1 hour' THEN 'unresponsive'
WHEN reports.noop = TRUE THEN 'noop'
ELSE resport_statuses.status
END) AS latest_report_status,
certnames.certname
FROM certnames
LEFT JOIN reports ON certnames.latest_report_id = reports.id
LEFT JOIN report_statuses ON reports.status_id = report_statuses.id;
@ajroetker
ajroetker / merge-conflict.rb
Created July 15, 2015 20:06
WHAT DO IT DO?!!?!?
<<<<<<< HEAD
def get_package_version(host, version = nil)
version = PuppetDBExtensions.config[:package_build_version].to_s
# version can look like:
# 3.0.0
# 3.0.0.SNAPSHOT.2015.07.08T0945
# Rewrite version if its a SNAPSHOT in rc form
if version.include?("SNAPSHOT")