Skip to content

Commit

Permalink
Remove references to now deprecated attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Dwyer <bdwyer@IEEE.org>
  • Loading branch information
bdwyertech committed Aug 7, 2018
1 parent c70d720 commit 1b72df0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions libraries/helper.rb
Expand Up @@ -2,7 +2,7 @@

#
# Cookbook:: wildfly
# Library:: config
# Library:: Helper
#
# Copyright:: 2018, Brian Dwyer - Intelligent Digital Services
#
Expand All @@ -25,17 +25,19 @@ module Helper

# => Search for a WildFly Instance and grab its Configuration Properties
def wildfly_cfg(resource_name = 'wildfly')
resource_name ||= 'wildfly'
resource_type = 'wildfly'

rc = Chef.run_context.resource_collection if Chef.run_context
result = rc.find(resource_type => resource_name) rescue nil # rubocop: disable RescueModifier

cfg = {}
unless result
cfg['user'] = Chef.node['wildfly']['user']
cfg['group'] = Chef.node['wildfly']['group']
cfg['dir'] = Chef.node['wildfly']['base']
cfg['service'] = Chef.node['wildfly']['service']
Chef::Log.warn("WildFly::Helper:: Could not detect resource #{resource_name}... Returning sane defaults.")
cfg['user'] = resource_name
cfg['group'] = resource_name
cfg['dir'] = ::File.join(::File::SEPARATOR, 'opt', resource_name)
cfg['service'] = resource_name
cfg['port'] = '9990'
return cfg
end
Expand Down
2 changes: 1 addition & 1 deletion recipes/mysql_datasources.rb
Expand Up @@ -29,7 +29,7 @@

mysql['jndi']['datasources'].each do |source|
# => Configure MySQL Datasource
template ::File.join(wildfly['base'], 'standalone', 'deployments', "#{::File.basename(source['jndi_name'])}-ds.xml") do
template ::File.join(WildFly::Helper.wildfly_cfg['dir'], 'standalone', 'deployments', "#{::File.basename(source['jndi_name'])}-ds.xml") do
source 'mysql-ds.xml.erb'
user wildfly['user']
group wildfly['group']
Expand Down
2 changes: 1 addition & 1 deletion recipes/postgres_datasources.rb
Expand Up @@ -29,7 +29,7 @@

postgres['jndi']['datasources'].each do |source|
# => Configure PostgreSQL Datasource
template ::File.join(wildfly['base'], 'standalone', 'deployments', "#{::File.basename(source['jndi_name'])}-ds.xml") do
template ::File.join(WildFly::Helper.wildfly_cfg['dir'], 'standalone', 'deployments', "#{::File.basename(source['jndi_name'])}-ds.xml") do
source 'postgres-ds.xml.erb'
user wildfly['user']
group wildfly['group']
Expand Down
2 changes: 1 addition & 1 deletion resources/mysql_connector.rb
Expand Up @@ -26,7 +26,7 @@
mysql = node['wildfly']['mysql']

# => Define the Resource Properties
property :instance, String, required: false
property :instance, String, name_property: true
property :base_dir, String, default: lazy { WildFly::Helper.wildfly_cfg(instance)['dir'] }
property :url, String, default: mysql['url']
property :checksum, String, default: mysql['checksum']
Expand Down
2 changes: 1 addition & 1 deletion resources/postgres_connector.rb
Expand Up @@ -25,7 +25,7 @@
postgresql = node['wildfly']['postgresql']

# => Define the Resource Properties
property :instance, String, required: false
property :instance, String, name_property: true
property :base_dir, String, default: lazy { WildFly::Helper.wildfly_cfg(instance)['dir'] }
property :url, String, default: postgresql['url']
property :checksum, String, default: postgresql['checksum']
Expand Down

0 comments on commit 1b72df0

Please sign in to comment.