Skip to content

Instantly share code, notes, and snippets.

elsif File.exists?('/etc/slackware-version')
platform "slackware"
platform_family "slackware"
platform_version File.read("/etc/slackware-version").scan(/(\d+|\.+)/).join
elsif File.exists?('/etc/arch-release')
platform "arch"
platform_family "arch"
# no way to determine platform_version in a rolling release distribution
# kernel release will be used - ex. 2.6.32-ARCH
class Chef::Provider::Service::Simple <<< Chef::Provider::Service
def shared_requirements
requirements.assert(:all_actions) do |a|
a.assertion { @new_resource.status_command or @new_resource.supports[:status] or
(!ps_cmd.nil? and !ps_cmd.empty?) }
a.failure_message Chef::Exceptions::Service, "#{@new_resource} could not determine how to inspect the process table, please set this nodes 'command.ps' attribute"
end
requirements.assert(:all_actions) do |a|
a.assertion { !@ps_command_failed }
def run_callback_from_file(callback_file)
if whyrun_mode?
recipe_eval { }
else
if ::File.exist?(callback_file)
Dir.chdir(release_path) do
Chef::Log.info "#{@new_resource} running deploy hook #{callback_file}"
recipe_eval { from_file(callback_file) }
end
end
source :rubygems
gem 'chef-pedant-core', :git => "git@github.com:opscode/chef-pedant-core.git"
gem 'oc-chef-pedant-core', :git => "git@github.com:opscode/oc-chef-pedant-core.git"
gem 'oc-reporting-pedant-tests', :path => "."
Gem::Specification.new do |s|
s.name = 'oc-reporting-pedant-tests'
s.version = '0.0.1'
s.date = '2012-11-05'
s.summary = "API tests for Opscode's Private Chef Reporting Services"
s.description = "API tests for Opscode's Private Chef Reporting Server; requires Pedant to actually run"
s.authors = ["Marc Paradise"]
s.email = 'marcg@opscode.com'
s.files = Dir['spec/**/*_spec.rb'] + Dir['lib/**/*.rb']
s.homepage = 'http://opscode.com'
require 'spec_helper'
require 'open-uri'
require 'pedant/rspec/common'
require 'pedant/rspec/node_util'
require 'spec/support/node_run_util'
describe "Node Runs API endpoint" do
include_context "node_run_util"
include Pedant::RSpec::NodeUtil
@marcparadise
marcparadise / gist:7043972
Created October 18, 2013 16:20
An alias to send files to a shared vim session that is specific to the current tmux window. Allows you to have one vim session for each window that is used to open files from any pane in that window. Requires vim to be built w/ `+clientserver`
if [[ -z $TMUX ]]; then
server_name="--servername VIM"
else
server_name="--servername vim-`tmux display-message -p '#S.#I'`"
fi
alias vis="vim $server_name --remote-tab-silent"
bash -c '
<%= "export https_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
distro=`uname -s`
if test "x$distro" = "xSunOS"; then
if test -d "/usr/sfw/bin"; then
PATH=/usr/sfw/bin:$PATH
export PATH
fi
%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 et
-module(user_default).
-compile(export_all).
-include("/srv/piab/mounts/oc_erchef_lite/deps/chef_objects/include/chef_types.hrl").
-include("/srv/piab/mounts/oc_erchef_lite/deps/oc_chef_authz/include/oc_chef_authz.hrl").
-include("/srv/piab/mounts/oc_erchef_lite/deps/oc_chef_authz/include/oc_chef_types.hrl").
%-include("/srv/piab/mounts/oc_erchef_lite/deps/oc_chef_wm/include/oc_chef_wm.hrl").
%-include("/srv/piab/mounts/oc_erchef_lite/deps/chef_wm/include/chef_wm.hrl").
@marcparadise
marcparadise / update-permissions.sh
Created November 10, 2014 20:25
A simple shell script that will disable (or enable) C/U/D permissions on all existing data bags in your organization.
#!/bin/bash
# This requires the knife-acl plugin.
# If you don't wish to modify permissions for all data bags,
# you will need to substitute your own command for supplying the
# list of data bags to modify.
for bag in $(knife data bag list); do
echo "Updating permissons on $bag."
knife acl remove data $bag update group clients