I'm trying to set up a chef recipe for automatic deployment of my app over ssl with tomcat chef cookbook.
It works fine without ssl, but when I try to set the attributes for ssl support I'm getting error:
undefined method `truststore_password' for Custom resource tomcat_instance from cookbook tomcat.
My role:
name "myapp"
override_attributes ({
"java" => {
"jdk_version"=> "6"
},
"oracle" => {
"accept_oracle_download_terms" => true
},
"tomcat" => {
"base_version" => 7,
"java_options" => "${JAVA_OPTS} -Xmx128M -Djava.awt.headless=true",
"secure" => true,
"client_auth" => true,
"scheme" => "https",
"ssl_enabled_protocols" => "TLSv1",
"keystore_password" => "mypass",
"truststore_password" => "mypass",
"ciphers" => "SSL_RSA_WITH_RC4_128_SHA",
"keystore_file" => "/etc/tomcat7/client.jks",
"truststore_file" => "/etc/tomcat7/cert.jks"
}
})
run_list "recipe[java]", "recipe[tomcat]"
Maybe I'm missing something, because I can't find any good tutorials on how to do this I'm also using chef-solo with vagrant.
If you look at the Tomcat cookbook documentation, you will see the following regarding the truststore_password attribute:
node['tomcat']['truststore_password'] - Generated by the secure_password method from the
openssl cookbook; if you are using Chef Solo,
set this attribute on the node
Perhaps this means that you can not set the attribute in your role definition whilst using Chef Solo, and you have to manually add it to the node attributes JSON file.
Related
I'm converting a php project to use composer as dependency manager.
The dependencies are loaded via this line in my main script.
require 'vendor/autoload.php';
One of these dependencies is hybridauth (version 2.9). Since using Composer, it throws 'file not found' errors when looking for custom providers files.
For instance, my main controller calls Hybrid like this:
$config_file_path = dirname(__FILE__) .'/hybridauth/config.php';
$hybridauth = new Hybrid_Auth( $config_file_path );
Now, here is the config file. The provider i'm using is "Facebooktest".
Note that I had to specify the path via the [wrapper][path]; array key to get to the next error message.
return
array(
"base_url" => WWWROOT."/auth",
"providers" => array(
"Facebook" => array(
"enabled" => true,
"keys" => array("id" => "xxxxxxx", "secret" => "xxxxxxxx"),
"scope" => "email",
"trustForwarded" => false
),
"Facebooktest" => array(
"enabled" => true,
"keys" => array("id" => "xxxxxxx", "secret" => "xxxxxx"),
"scope" => "email",
"trustForwarded" => false,
"wrapper"=> array(
"class"=>'Hybrid_Providers_Facebooktest',
"path"=> './controllers/hybridauth/Hybrid/Providers/Facebooktest.php'
)
)
),
"debug_mode" => false,
"debug_file" => "",
);
The error message (with trace):
require_once(/path/to/composer-project/vendor/hybridauth/hybridauth/hybridauth/Hybrid/thirdparty/Facebook/autoload.php): failed to open stream: No such file or directory
[vendor/bcosca/fatfree/lib/base.php:2174] Base->error()
[controllers/hybridauth/Hybrid/Providers/Facebooktest.php:61] Base->{closure}()
[controllers/hybridauth/Hybrid/Providers/Facebooktest.php:61] require_once()
[vendor/hybridauth/hybridauth/hybridauth/Hybrid/Provider_Model.php:99] Hybrid_Providers_Facebooktest->initialize()
[vendor/hybridauth/hybridauth/hybridauth/Hybrid/Provider_Adapter.php:101] Hybrid_Provider_Model->__construct()
[vendor/hybridauth/hybridauth/hybridauth/Hybrid/Auth.php:278] Hybrid_Provider_Adapter->factory()
[vendor/hybridauth/hybridauth/hybridauth/Hybrid/Auth.php:230] Hybrid_Auth::setup()
[controllers/auth-action.get.php:19] Hybrid_Auth::authenticate()
I find it strange that I now need to modify paths inside the "vendor/hybridauth/" project. It defeats the purpose of using a dependency manager. Surely, I must be doing it wrong.
Can you advise?
Check my answer to another question here
If you have recently installed Hybridauth through composer you probably have downloaded v2.9.2, which contain a bug in their Facebook class that replace the vendor path from yours to hybridauth/vendor, causing such issue.
I suspect you created that Facebooktest class by copying their Facebook class and therefore sustained that error. Either update to their dev branch and copy that Facebook class, or simply use other provider class as template for your custom provider class.
I am new to chef and seeing the following code in metadata.rb file for a project handed over to me from someone.
attribute 'setup',
:required => 'required',
:default => 'internal',
:format => {
:category => '1.Global',
:order => 1,
:filter => {'all' => {'visible' => 'true'}},
:form => {'field' => 'select', 'options_for_select' => [
['External', 'external'], ['Internal','internal']
]
}
}
I have gone through both https://docs.chef.io/config_rb_metadata.html and
https://docs.chef.io/attributes.html but unable to understand most of the non-obvious constructs like category, order, filter, form etc.
Are these not part of the standard chef packages?
The metadata fields still exist but nothing in the Chef ecosystem ever used them (except maybe old versions of Rightscale but that's not really "Chef ecosystem" anymore). Because of this we remove most of the docs about the feature. You can delete at will most likely, unless you have custom tools that use the data.
I am using softlayer's ruby API, and i am trying to create a virtual server under a specific subnet in a VLAN and i couldnt find a way of doing it.
At the moment i am using the following json:
creation_hash = {
'complexType' => 'SoftLayer_Virtual_Guest',
'hostname' => XXX,
'domain' => XXXX
'datacenter' => { 'name' => #datacenter },
'startCpus' => sl_machine_type(#params['instance_type'])['cpu'],
'maxMemory' => sl_machine_type(#params['instance_type'])['memory'],
'hourlyBillingFlag' => true,
'blockDeviceTemplateGroup' => { 'globalIdentifier' => #params['image_id'] },
'localDiskFlag' => false,
'dedicatedAccountHostOnlyFlag' => true,
'primaryBackendNetworkComponent' => {
'networkVlan' => {
'id' => #private_vlan['id']
}
},
'networkComponents' => [{ 'maxSpeed' => 1000 }],
'privateNetworkOnlyFlag' => true
}
so when i choose a VLAN, it chooses a random subnet under that VLAN.
how can i specify a subnet ? i didnt find this option in the documentation.
Unfortunately it is not possible to specify which subnet a server should be provisioned into.
The provisioning system will choose an IP from the VLAN's primary subnet.
The wording is a bit vague in this article, but it states that IPs are automatically assigned. I will get it updated to state that it is not possible to request a specific block of IPs for the primary.
Adding an IP to the server from a secondary subnet directly after provisioning could be a possible work around. This could be done with a post install script or config manager(salt, chef, etc), if automation is needed. It would also allow you to control specifically which IPs are used for each server.
The following code works great but only when the datastore specified is in the root of the datacenter. We organise our datastores in folders with the same name as the cluster they are associated with.
Tried putting a path in (e.g. dc_name/ds_name) but no good.
server=connection.vm_clone( 'datacenter' => 'EWL',
'template_path' => '.Templates/RHEL 6.2 x64',
'name' => 'new_vm_name',
'datastore' => 'E2-CL01-T2-OS-015',
'dest_folder' => 'Self-Service',
'transform' => 'sparse',
'power_on' => false )
Any clues?
I am developing puppet manifests for provisioning a VM through Vagrant. I am also new to puppet. While trying to use puppetlabs/apt module, I am encountering problems:
# manifests/default.pp (with commented lines removed)
import "stdlib"
import "apt"
class { 'apt':
always_apt_update => false,
disable_keys => undef,
proxy_host => false,
proxy_port => '8080',
purge_sources_list => false,
purge_sources_list_d => false,
purge_preferences_d => false
}
apt::release { "sid":}
This is the error message:
Puppet::Parser::AST::Resource failed with error ArgumentError:
Invalid resource type apt::release at /tmp/vagrant-puppet/manifests/default.pp:18
on node vmas1.dokeda.lt
I have been reading puppet docs; however, it hasn't helped. Could someone explain to me how to properly use this module?
I think the README incorrectly implies that apt::release is a define or type, when in fact the source code shows it's a class.
Instead, try calling it like this:
class { 'apt::release':
release_id => 'sid',
}
Also be sure not to use "import" but instead use "include".
Import is deprecated in more recent versions of puppet.