Skip to content

Instantly share code, notes, and snippets.

@hesco
hesco / gist:f3757e8acee55a332c01
Created September 7, 2014 13:52
Latest changes to join() function break puppetlabs-postgresql module.
The https://github.com/puppetlabs/puppetlabs-postgresql does not seem to accept bug reports filed by the public. │
In the latest catalogue run on this node I see:
Notice: /File[/var/lib/puppet/lib/puppet/parser/functions/join.rb]/content:
content changed '{md5}a285a05c015ae278608f6454aef211ea' to '{md5}ad3be01a800e9db75f9f0b8db1c2
followed immediately by:
Error 400 on SERVER: join() needs two arguments at /etc/puppet/modules/postgresql/manifests/validate_db_connection.pp:43
which I surmise to mean that the latest changes to the puppet parser's join function broke the postgresql module where it used a legacy interface to that function. Any chance that the authors of either of those modules might be accessible here this Sunday morning?
diff --git a/TODO b/TODO
index e69de29..25850e8 100644
--- a/TODO
+++ b/TODO
@@ -0,0 +1,6 @@
+
+In lib/puppet/provider/vcsrepo/git.rb
+need to provide an unless attribute, like so:
+
+ unless => "/usr/bin/test `/usr/bin/git describe --tags | /bin/grep $DEPLOY_REVISION | /usr/bin/wc -l` -eq 1 ",
require 'facter'
Facter.add(:system_env) do
setcode do
hostname = Facter::Util::Resolution.exec('hostname -s')
if hostname[4] == "p"
env = "prod"
elsif hostname[4] == "d"
env = "dev"
elsif hostname[4] == "u"
env = "uat"
@hesco
hesco / drupal_perms
Created March 3, 2015 15:22
drupal permissions
adduser www-data drupal
cd $DRUPAL_ROOT
chown -R drupal: .
find . -type d -exec chmod u=rwx,g=rx,o= {} \;
find . -type f -exec chmod u=rw,g=r,o= {} \;
@hesco
hesco / gist:4468021
Created January 6, 2013 15:46
With proper permissions, my code is unable to chdir; why?
This one has me stumped.
The user with which I am developing this owns that directory,
and in a bash shell, has no issues whatsoever changing to that
directory. Yet somehow (driven from my test script), my module
seems unwilling to make this change. And as a consequence, my
script is blowing up several lines later (thankfully) when it
attempts to overwrite the site I want to update with the updated
code.
@hesco
hesco / gist:4571823
Created January 19, 2013 10:24
Curious to know what may be illegal about this syntax . . .
perl t/103-sometest.t
ok 1 - use MyApp::SomeModule;
param(): illegal syntax at lib/MyApp/Base.pm line 58
# Tests were run but no plan was declared and done_testing() was not seen.
------------------------------
package MyApp::Base;
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Mojo;
use Data::Dumper;
use FindBin;
require "$FindBin::Bin/../scripts/www/admin/password_reset";
my $t = Test::Mojo->new();
@hesco
hesco / gist:5020130
Last active December 14, 2015 03:19
Brand new to both Mojolicious and to HTML::FormHandler, only been toying with these tools for less than an hour a day over the past week or so, plus perhaps a day of reading perldoc and tutorials and watching videos. Here is what I've got and what I'm seeing. My question is this: What happened to my \@config_files on the way to instantiating my …
logs . . .
[Sun Feb 24 12:18:33 2013] [debug] GET /password_reset (Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.19 (KHTML, like Gecko) Chrome/25.0.1323.1 Safari/537.19).
[Sun Feb 24 12:18:33 2013] [debug] Routing to a callback.
The password_reset scripts says: $VAR1 = {
'config_files' => [
't/conf/myapp_api.ini'
]
};
::ResetPassword->my_app says config_files is: $VAR1 = [
$ perl 9998-throw-me-away.t
::ResetPassword->myapp says config_files is: $VAR1 = [
't/conf/myapp_api.ini'
];
ok 1 - The object isa MyApp::ThisApplication
1..1
-------------------------------------
@hesco
hesco / gist:5177119
Created March 16, 2013 16:19
I am writing a module (App::DB::Backup, which uses Moose) which `extends 'App::Base', 'App::DB';` App::DB also `extends 'App::Base';` (which both also use Moose). One of the new module's attributes has a default which wants to use a ->cfg attribute provided by the ::Base class. But trying to instantiate my new class gives me a 'Attribute (cfg) d…
-----------------------------
the errors I am seeing
-----------------------------
$ perl t/9999-app-db-backup.t
# Testing App::DB::Backup
ok 1 - use App::DB::Backup;
Attribute (cfg) does not pass the type constraint because: Validation failed for 'Config::Simple' with value undef (not isa Config::Simple) at /usr/local/lib/perl/5.10.1/Moose/Meta/Attribute.pm line 1274
Moose::Meta::Attribute::verify_against_type_constraint('Moose::Meta::Attribute=HASH(0x9c3dd98)', undef, 'instance', 'App::DB::Backup=HASH(0x9ce6f10)') called at /usr/local/lib/perl/5.10.1/Moose/Meta/Attribute.pm line 1261
Moose::Meta::Attribute::_coerce_and_verify('Moose::Meta::Attribute=HASH(0x9c3dd98)', undef, 'App::DB::Backup=HASH(0x9ce6f10)') called at /usr/local/lib/perl/5.10.1/Moose/Meta/Attribute.pm line 531