This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var1 = node['domain_home'] + "/" + node['domain_name'] + "/var1" | |
var2 = node['domain_home'] + "/somepath/var2" | |
%w{var1 var2} each do |domain_directory| | |
directory domain_directory do | |
mode 0775 | |
owner 'weblogic' | |
group 'weblogic' | |
action :create | |
recursive true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here's some test stuff I've setup to figure this out: | |
access_control provider: | |
action :add do | |
if new_resource.environments.include?(node.chef_environment) | |
case new_resource.type | |
when "user" | |
puts "" | |
puts "Default before add: #{node.default.authorization.access.users}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RubyGems Environment: | |
- RUBYGEMS VERSION: 2.0.7 | |
- RUBY VERSION: 1.9.3 (2013-06-27 patchlevel 448) [x86_64-linux] | |
- INSTALLATION DIRECTORY: /opt/ruby/1.9.3-p448/lib/ruby/gems/1.9.1 | |
- RUBY EXECUTABLE: /opt/ruby/1.9.3-p448/bin/ruby | |
- EXECUTABLE DIRECTORY: /opt/ruby/1.9.3-p448/bin | |
- RUBYGEMS PLATFORMS: | |
- ruby | |
- x86_64-linux | |
- GEM PATHS: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IFS=: | |
while read -r name data; do | |
if [[ "$data" =~ CRLF ]]; then | |
dos2unix $name | |
fi | |
done < <(find . -type f -exec file {} \;) | |
unset IFS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e = execute "yum install -y -q libxml2 libxml2-devel libxslt libxslt-devel" do | |
action :nothing | |
end | |
e.run_action(:run) | |
g = gem_package "fog" do | |
version "1.1.2" | |
action :nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo cat /var/chef/cache/chef-stacktrace.out | |
Generated at 2012-12-03 16:41:30 -0700 | |
NoMethodError: gem_package[fog] (s3_file::default line 27) had an error: NoMethodError: undefined method `full_name' for nil:NilClass | |
/usr/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:136:in `block in gather_dependencies' | |
/usr/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:136:in `map' | |
/usr/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:136:in `gather_dependencies' | |
/usr/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:267:in `install' | |
/usr/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/provider/package/rubygems.rb:169:in `block (2 levels) in install' | |
/usr/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/provider/package/rubygems.rb:192:in `with_correct_verbosity' | |
/usr/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/provider/package/rubygems.rb:168:in `block in install' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NoMethodError: gem_package[fog] (s3_file::default line 27) had an error: NoMethodError: undefined method `full_name' for nil:NilClass | |
/usr/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:136:in `block in gather_dependencies' | |
/usr/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:136:in `map' | |
/usr/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:136:in `gather_dependencies' | |
/usr/lib/ruby/site_ruby/1.9.1/rubygems/dependency_installer.rb:267:in `install' | |
/usr/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/provider/package/rubygems.rb:169:in `block (2 levels) in install' | |
/usr/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/provider/package/rubygems.rb:192:in `with_correct_verbosity' | |
/usr/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/provider/package/rubygems.rb:168:in `block in install' | |
/usr/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/provider/package/rubygems.rb:103:in `with_gem_sources' | |
/usr/lib/ruby/gems/1.9.1/gems/chef-10.12.0/lib/chef/provider/package/rubygems.rb:167:in `install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is what I have in my recipe: | |
bash "Set newrelic java options" do | |
user "root" | |
group "root" | |
cwd glassfishconfig | |
code <<-EOH | |
awk -v searchterm="<java-config" -v payload=" <jvm-options>-javaagent:#{newrelic_dir}/newrelic-#{node[:newrelic][:version]}/newrelic.jar</jvm-options>\n <jvm-options>-Dnewrelic.config.file=#{newrelic_dir}/#{node[:app][:key]}/newrelic.yml</jvm-options>\n <jvm-options>-Dnewrelic.config.log_file_path=#{newrelic_dir}/#{node[:app][:key]}/logs</jvm-options>" '{ if ($0 ~ searchterm) print $0 "\n" payload; else print $0 }' domain.xml.newrelic.bak > domain.xml | |
EOH | |
action :nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following is for a chef-client 0.10.8 run | |
This is what it says in chef wiki concerning the service resource (http://wiki.opscode.com/display/chef/Resources#Resources-Service): | |
:status - the init script or other service provider can use a status command to determine if the service is running. If this is not specified, Chef will attempt to match the service_name against the process table as a regular expression, unless pattern is specified as a parameter attribute. | |
I have a service who's init script isn't proper so it doesn't support chkconfig, status, etc. It will eventually be fixed but not now. In the mean time it doesn't appear as if chef is doing what the wiki says it'll do. | |
Here's the resource from the recipe: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Script for pushing logs to s3 | |
# | |
#require 'rubygems' | |
#require 'yaml' | |
require 'fog' | |
config_file = File.join(File.dirname(__FILE__),"logmoverconfig.yml") |