Skip to content

Instantly share code, notes, and snippets.

@derekperkins
derekperkins / gist:7782886
Created December 4, 2013 05:35
Build errors
[2013-12-04T05:34:01+00:00] INFO: Forking chef instance to converge...
[2013-12-04T05:34:01+00:00] INFO: *** Chef 11.8.2 ***
[2013-12-04T05:34:01+00:00] INFO: Chef-client pid: 4890
[2013-12-04T05:34:09+00:00] INFO: Setting the run_list to ["role[development]", "recipe[nozzle::default]"] from JSON
[2013-12-04T05:34:10+00:00] INFO: Run List is [role[development], recipe[nozzle::default]]
[2013-12-04T05:34:10+00:00] INFO: Run List expands to [apt, build-essential, htop, vim, chef-php54, java::openjdk, mysql::server, mysql::ruby, redis::server, nozzle::default]
[2013-12-04T05:34:10+00:00] INFO: Starting Chef Run for dvagrant
[2013-12-04T05:34:10+00:00] INFO: Running start handlers
[2013-12-04T05:34:10+00:00] INFO: Start handlers complete.
[2013-12-04T05:34:10+00:00] INFO: HTTP Request Returned 404 Object Not Found: error
@derekperkins
derekperkins / gist:7596590
Last active December 29, 2015 01:58
ES or query
***This works as an AND query
$query['conditions'] = [
'has_child' => [
'model' => 'WorkspacePostTag',
'workspace_id' => 2,
'post_id' => 4
]
];
@derekperkins
derekperkins / gist:7596432
Created November 22, 2013 08:00
Elasticsearch Stacktrace
Missing Database Table
Error: Table app_models for model AppModel was not found in datasource default.
Notice: If you want to customize this error message, create htdocs/View/Errors/missing_table.ctp
Stack Trace
APP/Vendor/pear-pear.cakephp.org/CakePHP/Cake/Model/Model.php line 3476 → Model->setSource(string)
APP/Model/AppModel.php line 52 → Model->getDataSource()
@derekperkins
derekperkins / gist:7596423
Created November 22, 2013 07:59
Elasticsearch Datasource Conditions
$query['conditions'] = [
'has_child' => [
'type' => 'workspaces_posts_tags',
'workspace_id' => 2
]
];
@derekperkins
derekperkins / gist:7462343
Created November 14, 2013 06:26
CakePHP ElasticsearchBehavior
<?php
class ElasticsearchBehavior extends ModelBehavior {
public function beforeFind(Model $Model, $query) {
if(!empty($query['conditions']['elastic'])) {
$Model->switchToElastic();
unset($query['conditions']['elastic']);
}
<?php
function geocode($address) {
$apikey = "key=Fmjtd%7Cluub256a2u%2C2x%3Do5-9urwg6";
$url = "http://open.mapquestapi.com/geocoding/v1/address?";
$options = "&inFormat=kvp&outFormat=json&thumbMaps=false&maxResults=1";
$location = "&location=".urlencode($address);
$results = json_decode(file_get_contents($url.$apikey.$options.$location));
@derekperkins
derekperkins / gist:6987415
Created October 15, 2013 06:35
Composer error
[2013-10-15T06:12:40+00:00] INFO: Update package: /var/www/nozzle/htdocs
[2013-10-15T06:12:40+00:00] INFO: Install package in directory: /var/www/nozzle/ htdocs
[2013-10-15T06:12:40+00:00] WARN: Cloning resource attributes for execute[instal l-composer-packages] from prior resource (CHEF-3694)
[2013-10-15T06:12:40+00:00] WARN: Previous execute[install-composer-packages]: / var/chef/cache/cookbooks/composer/providers/package.rb:5:in `block in class_from _file'
[2013-10-15T06:12:40+00:00] WARN: Current execute[install-composer-packages]: /
@derekperkins
derekperkins / gist:6967630
Created October 13, 2013 21:28
stacktrace
Generated at 2013-10-13 21:12:24 +0000
Net::HTTPServerException: 403 "Forbidden"
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:2633:in `error!'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:207:in `block in raw_http_request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:289:in `retriable_rest_request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:167:in `raw_http_request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:161:in `api_request'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/rest.rb:128:in `put'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/node.rb:489:in `save'
/var/chef/cache/cookbooks/mysql/recipes/server.rb:42:in `from_file'
@derekperkins
derekperkins / gist:6967559
Created October 13, 2013 21:21
Provision error
[2013-10-13T21:11:58+00:00] INFO: execute[apt-get-update-build-essentials] ran successfully
[2013-10-13T21:12:23+00:00] WARN: Cloning resource attributes for package[build-essential] from prior resource (CHEF-3694)
[2013-10-13T21:12:23+00:00] WARN: Previous package[build-essential]: /var/chef/cache/cookbooks/build-essential/recipes/debian.rb:40:in `block in from_file'
[2013-10-13T21:12:23+00:00] WARN: Current package[build-essential]: /var/chef/cache/cookbooks/mysql/recipes/client.rb:46:in `block in from_file'
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/mysql/recipes/server.rb
================================================================================
@derekperkins
derekperkins / gist:6959368
Created October 13, 2013 07:52
Revamp provisioning
Derek@Derek /cygdrive/c/vagrant/nozzle-chef
$ vagrant up --provider=vmware_workstation
Bringing machine 'default' up with 'vmware_workstation' provider...
[default] Box 'derek-vagrant-revamp' was not found. Fetching box from specified URL for
the provider 'vmware_workstation'. Note that if the URL does not have
a box for this provider, you should interrupt Vagrant now and add
the box yourself. Otherwise Vagrant will attempt to download the
full box prior to discovering this error.
Downloading or copying the box...
Extracting box...ate: 1969k/s, Estimated time remaining: --:--:--)