Skip to content

Commit

Permalink
Merge pull request #419 from qld-gov-au/QOLDEV-545-opsworks-decommission
Browse files Browse the repository at this point in the history
QOLDEV-545 look up plugin definitions just in time during deployment
  • Loading branch information
ThrawnCA authored Apr 9, 2024
2 parents 52e416a + 92f432d commit c01adf3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
8 changes: 0 additions & 8 deletions recipes/ckanparams.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,7 @@
node.default['datashades']['ckan_web']['beaker_secret'] = `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/app/#{node['datashades']['app_id']}/beaker_secret" --query "Parameter.Value" --with-decryption --output text`.strip
node.default['datashades']['ckan_web']['dbuser'] = `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/db/#{node['datashades']['app_id']}_user" --query "Parameter.Value" --output text`.strip
node.default['datashades']['postgres']['password'] = `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/db/#{node['datashades']['app_id']}_password" --query "Parameter.Value" --with-decryption --output text`.strip

node.default['datashades']['ckan_web']['plugin_app_names'] = `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/app/#{node['datashades']['app_id']}/plugin_app_names" --query "Parameter.Value" --output text`.strip.split(',')
for plugin in node['datashades']['ckan_web']['plugin_app_names'] do
node.default['datashades']['ckan_web']['plugin_apps'][plugin]['name'] = `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/app/#{node['datashades']['app_id']}/plugin_apps/#{plugin}/name" --query "Parameter.Value" --output text`.strip
node.default['datashades']['ckan_web']['plugin_apps'][plugin]['shortname'] = `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/app/#{node['datashades']['app_id']}/plugin_apps/#{plugin}/shortname" --query "Parameter.Value" --output text`.strip
node.default['datashades']['ckan_web']['plugin_apps'][plugin]['app_source']['type'] = `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/app/#{node['datashades']['app_id']}/plugin_apps/#{plugin}/app_source/type" --query "Parameter.Value" --output text`.strip
node.default['datashades']['ckan_web']['plugin_apps'][plugin]['app_source']['url'] = `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/app/#{node['datashades']['app_id']}/plugin_apps/#{plugin}/app_source/url" --query "Parameter.Value" --output text`.strip
node.default['datashades']['ckan_web']['plugin_apps'][plugin]['app_source']['revision'] = `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/app/#{node['datashades']['app_id']}/plugin_apps/#{plugin}/app_source/revision" --query "Parameter.Value" --output text`.strip
end

# Derive defaults from other values
node.default['datashades']['ckan_web']['dsname'] = "#{node['datashades']['ckan_web']['dbname']}_datastore"
Expand Down
10 changes: 5 additions & 5 deletions recipes/ckanweb-deploy-exts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,17 @@
harvest_present = false
csrf_present = false

node['datashades']['ckan_web']['plugin_app_names'].each do |app|
node['datashades']['ckan_web']['plugin_app_names'].each do |plugin|

egg_name = node['datashades']['ckan_web']['plugin_apps'][app]['shortname']
egg_name = `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/app/#{node['datashades']['app_id']}/plugin_apps/#{plugin}/shortname" --query "Parameter.Value" --output text`.strip

# Install Extension
#

datashades_pip_install_app egg_name do
type node['datashades']['ckan_web']['plugin_apps'][app]['app_source']['type']
revision node['datashades']['ckan_web']['plugin_apps'][app]['app_source']['revision']
url node['datashades']['ckan_web']['plugin_apps'][app]['app_source']['url']
type `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/app/#{node['datashades']['app_id']}/plugin_apps/#{plugin}/app_source/type" --query "Parameter.Value" --output text`.strip
revision `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/app/#{node['datashades']['app_id']}/plugin_apps/#{plugin}/app_source/url" --query "Parameter.Value" --output text`.strip
url `aws ssm get-parameter --region "#{node['datashades']['region']}" --name "/config/CKAN/#{node['datashades']['version']}/app/#{node['datashades']['app_id']}/plugin_apps/#{plugin}/app_source/revision" --query "Parameter.Value" --output text`.strip
end

# Many extensions use a different name on the plugins line so these need to be managed
Expand Down

0 comments on commit c01adf3

Please sign in to comment.