Skip to content

Instantly share code, notes, and snippets.

file { '/root/foo.txt':
content => 'foo',
#source => 'puppet:///modules/foo/foo.txt',
ensure => file,
notify => Exec['execfoo'],
}
exec { 'execfoo':
command => "/bin/echo 'wassup'",
}
@cprice404
cprice404 / file_sync_ascii_art.txt
Created April 8, 2016 18:56
file sync ascii art
Sync code-staging to code via File Sync
mngq78kmt1ae4qo.delivery.puppetlabs.net 11:41:29$ curl --cert $(puppet config print hostcert) --key $(puppet config print hostprivkey) --cacert $(puppet config print localcacert) -H "Content-type: application/json" https://mngq78kmt1ae4qo.delivery.puppetlabs.net:8140/file-sync/v1/commit -d '{"commit-all": true}'
% T o t a l % R e c e i v e d % X f e r d A v e r a g e S p e e d T i m e T i m e T i m e C u r r e n t
D l o a d U p l o a d T o t a l S p e n t L e f t S p e e d
0 0 0 0 0 20 0 115 --:--:-- --:--:-- --:--:-- 115 0 0 0 0 0 20 0 17 --:--:-- 0:00:01 --:--:-- 0 0 0 0 0 0 20
2016-03-05 15:51:31,962 ERROR [async-dispatch-4] [p.t.internal] E
rror during service stop!!!
java.util.concurrent.TimeoutException: null
at org.eclipse.jetty.util.FutureCallback.get(FutureCallba
ck.java:128) ~[puppet-server-release.jar:na]
at org.eclipse.jetty.util.FutureCallback.get(FutureCallba
ck.java:30) ~[puppet-server-release.jar:na]
at org.eclipse.jetty.server.Server.doStop(Server.java:426
) ~[puppet-server-release.jar:na]
at org.eclipse.jetty.util.component.AbstractLifeCycle.sto
@cprice404
cprice404 / deps.clj
Created January 19, 2016 03:58
aether scratch
(let [system (repository-system)
session (repository-session
{:repository-system system})]
(.resolveDependencies
system
session
(DependencyRequest.
(CollectRequest.
[(dependency ['org.slf4j/slf4j-simple "1.7.13"])]
[(dependency ['org.slf4j/slf4j-api "1.6.6"])]
@cprice404
cprice404 / PrivateFoo.java
Created September 24, 2015 19:56
calling private java method from clojure
package com.puppetlabs.enterprise;
/**
* Created by cprice on 9/24/15.
*/
public class PrivateFoo {
private String foo(String bar, String baz) {
return bar + baz;
}
}
(deftest working-tree-rev-test
(let [local-git-dir (helpers/temp-dir-as-string)
local-work-tree (helpers/temp-dir-as-string)
remote-repo-dir (helpers/temp-dir-as-string)
remote-git (helpers/init-repo! (fs/file remote-repo-dir))]
(jgit-utils/clone remote-repo-dir local-git-dir true)
(helpers/write-test-file! (fs/file remote-repo-dir "foo.txt"))
(jgit-utils/add-and-commit remote-git "test commit1" helpers/test-person-ident)
@cprice404
cprice404 / hocon_auth_conf_spec.rb
Created August 13, 2015 08:32
hocon auth.conf POC
#!/usr/bin/env ruby
require 'hocon'
require 'hocon/parser/config_document_factory'
require 'hocon/config_value_factory'
TEST_RULES_FILE_CONTENT = <<EOS
authorization: {
rules: [
{rule_id: "00_my_first_rule"}
@cprice404
cprice404 / stats.txt
Created March 2, 2015 20:35
resource eval stats
Resource evaluations during compile, sorted by total CPU time spent (in ms)
NAME | AGGREGATE | COUNT | MEAN
-------------------------------------------------------------|-----------|-------|--------
Class[Puppet_enterprise::Profile::Amq::Broker] | 3733.0 | 3 | 1244.33
Class[Puppet_enterprise::Profile::Console] | 3416.0 | 3 | 1138.67
Class[Puppet_enterprise::Profile::Master] | 1745.0 | 3 | 581.67
Class[Puppet_enterprise::Profile::Mcollective::Agent] | 1513.0 | 3 | 504.33
Class[Puppet_enterprise::Profile::Puppetdb] | 1006.0 | 3 | 335.33
Class[Puppet_enterprise::Profile::Mcollective::Peadmin] | 420.0 | 3 | 140.0
@cprice404
cprice404 / 01-nested-exception.txt
Last active August 29, 2015 14:12
PE 3.7 JVM Overview: Code Samples
2015-01-01 11:54:30,773 ERROR [c.p.h.c.i.PersistentSyncHttpClient] Error executing http request
javax.net.ssl.SSLHandshakeException: General SSLEngine problem
at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1300) ~[na:1.7.0_71-icedtea]
at sun.security.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:513) ~[na:1.7.0_71-icedtea]
at sun.security.ssl.SSLEngineImpl.writeAppRecord(SSLEngineImpl.java:1180) ~[na:1.7.0_71-icedtea]
at sun.security.ssl.SSLEngineImpl.wrap(SSLEngineImpl.java:1152) ~[na:1.7.0_71-icedtea]
at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:469) ~[na:1.7.0_71-icedtea]
at org.apache.http.nio.reactor.ssl.SSLIOSession.doWrap(SSLIOSession.java:220) ~[puppet-server-release.jar:na]
at org.apache.http.nio.reactor.ssl.SSLIOSession.doHandshake(SSLIOSession.java:254) ~[puppet-server-release.jar:na]
at org.apache.http.nio.reactor.ssl.SSLIOSession.isAppInputReady(SSLIOSession.java:391) ~[puppet-server-release.jar:na]
@cprice404
cprice404 / 01-repl.md
Last active August 29, 2015 14:11
Puppet Server REPL dev
$ lein repl                                                                             
nREPL server started on port 41148 on host 127.0.0.1 -
  nrepl://127.0.0.1:41148
REPL-y 0.3.2, nREPL 0.2.3
Clojure 1.5.1
OpenJDK 64-Bit Server VM 1.7.0_65-b32
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
 Source: (source function-name-here)