Skip to content

Instantly share code, notes, and snippets.

@jblaine
jblaine / gist:6565513
Last active December 23, 2015 02:09
ChefSpec
# line-cookbook/recipes/_tester.rb
file "0" do
path "/tmp/.line-cookbook-testfile"
content "An opening line"
owner 'root'
group 'root'
mode '00644'
end
@jblaine
jblaine / gist:47f6191a084d319639e4
Created May 29, 2015 00:18
Intermediary SSL device certificate installation for chef_gem to even work
#
# Intermediary SSL device (sniffer/decrypter) certificate
# installation on Windows (w/o Cygwin) for chef_gem to even
# talk to https://rubygems.org from inside $WORK
#
# FML
#
node['our-certs']['filenames'].each do |cert|
cookbook_file cert do
@jblaine
jblaine / gist:240f09b0078efff2505b
Last active February 12, 2016 06:09
Come at me bro
for i in `curl --silent -H "X-JFrog-Art-Api:API_KEY_HERE_REDACTED" -X GET \
"https://artifacts.mitre.org/artifactory/api/search/badChecksum?type=sha1&repos=java-libs-release-local" \
| grep uri | awk '{print $3}' | sed -e 's/"//g' -e 's/,//g' \
-e 's/https:\/\/artifactory\.our\.org\/artifactory\/api\/storage\/java-libs-release-local\///g'`; \
do echo "{ \"repoKey\": \"java-libs-release-local\", \"path\": \"$i\" }" | \
curl --header "Content-Type:application/json" -H "X-JFrog-Art-Api:API_KEY_HERE_REDACTED" \
-X POST --verbose -d @- https://artifactory.our.org/artifactory/ui/checksums/fix; done
@jblaine
jblaine / gist:45a902e46d1e9047bc6f
Created March 1, 2016 14:41
git resource chef-client, PATH, etc.
[2016-03-01T09:31:00-05:00] INFO: Processing git[/usr/tools/hostdb] action sync (r701-hostdb::_update-advanced line 15)
[2016-03-01T09:31:00-05:00] DEBUG: Providers for generic git resource enabled on node include: [Chef::Provider::Git]
[2016-03-01T09:31:00-05:00] DEBUG: Provider for action sync on resource git[/usr/tools/hostdb] is Chef::Provider::Git
[2016-03-01T09:31:00-05:00] DEBUG: git[/usr/tools/hostdb] finding current git revision
[2016-03-01T09:31:00-05:00] INFO: Running queued delayed notifications before re-raising exception
[2016-03-01T09:31:00-05:00] DEBUG: Re-raising exception: Errno::ENOENT - git[/usr/tools/hostdb] (r701-hostdb::_update-advanced line 15) had an error: Errno::ENOENT: No such file or directory - git
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/mixlib-shellout-2.2.5/lib/mixlib/shellout/unix.rb:338:in `exec'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/mixlib-shellout-2.2.5/lib/mixlib/shellout/unix.rb:338:in `block in fork_subprocess'
/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/mi
@jblaine
jblaine / expire-R-PACKAGES-gz.groovy
Created March 17, 2016 13:11
Caused by: java.lang.ClassFormatError: Illegal class name "expire-R-PACKAGES-gz$getCacheAge" in class file expire-R-PACKAGES-gz$getCacheAge
import org.artifactory.fs.FileInfo
import org.artifactory.repo.RepoPath
import org.artifactory.request.Request
import static CacheConstants.PACKAGES_GZ_CACHE_MILLIS
class CacheConstants {
static final long PACKAGES_GZ_CACHE_MILLIS = 1800 * 1000L
}
isibed-1# ls -ld /bin/bash
-rwxr-xr-x 5 root wheel 958118 Apr 23 2015 /bin/bash
isibed-1# logout
isibed-1# /bin/bash --login
isibed-1# echo $SHELL
/usr/local/bin/zsh
isibed-1# env | grep BASH
isibed-1#
>south
You burn your hand on the steel doorknob and notice smoke creeeping through the cracks
around the door.
>north
Your path is blocked by a github issue in a complicated codebase. The fire on the other
side of the door begins to burn through...
>west
Your path is blocked by a different github issue in the same complicated codebase.

Keybase proof

I hereby claim:

  • I am jblaine on github.
  • I am cjeffblaine (https://keybase.io/cjeffblaine) on keybase.
  • I have a public key whose fingerprint is 837C 8831 0706 1D9E C03E 268E AE6C 4961 2B07 62CE

To claim this, I am signing this object:

@jblaine
jblaine / gist:a297b669eecdf745379071b1a0c07b0b
Created October 27, 2017 15:10
FileUtils.mv being EXECUTED at compile time from a library method?
# PART 1, THE EXCEPTION:
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/r701-apache/recipes/mcran-server.rb
================================================================================
Errno::ENOENT
-------------
No such file or directory @ rb_file_s_rename - (/tmp/r701-apache-tmp-certs.pem, /etc/httpd/conf/../supporting_certs/certs.pem)
Cookbook Trace:
#!/bin/sh
DATE=$(date +%Y%m%d)
STATUSFILE="$HOME/Status/$DATE"
if [ "$1"x = "x" ]; then
cat "$STATUSFILE"
elif [ "$1"x = "editx" ]; then
"$EDITOR" "$STATUSFILE"
else
echo "$@" >> "$STATUSFILE"