Skip to content

Commit

Permalink
feat(conf): get var name from puppet (#77)
Browse files Browse the repository at this point in the history
* feat(conf): get var name from puppet

Handle diffs between d7 and 8

* feat(distro): set conf name base on api version

* fix typo

* use string

* rename to settings
  • Loading branch information
minorOffense authored Sep 18, 2019
1 parent dae466f commit 8fb837a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion manifests/site.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
include drush
include stdlib

$distros = lookup("drupalsi::distros")

# Build the site root based on the distro information if siteroot is not specified.
if (empty($siteroot)) {
$distros = hiera("drupalsi::distros")
$distro_root = $distros[$distro]['distro_root']
$site_root = "$distro_root/$distro"
}
Expand All @@ -48,6 +49,17 @@
$sitessubdir = $sites_subdir
}

$confvar_name_d7 = 'conf'
$confvar_name_d8 = 'settings'

# Set the var name based on the api version.
if $distros[$distro]['api_version'] == '8' {
$confvar_name = $confvar_name_d8
}
else {
$confvar_name = $confvar_name_d7
}

# @todo create checks for other db types.
$db_exists_check = "test ! \$(drush sqlq --db-url=${db_url} 'SELECT COUNT(DISTINCT table_name) FROM information_schema.columns WHERE table_schema = (SELECT DATABASE());' --extra='-r -s') -gt 0"

Expand Down
4 changes: 2 additions & 2 deletions templates/settings.local.php.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* This file is managed by Puppet and should not be edited
*********************************************************/
<% if @pubdir != '' and @pubdir != nil -%>
$conf['file_public_path'] = '<%= @pubdir %>';
$<%= @confvar_name %>['file_public_path'] = '<%= @pubdir %>';
<% end -%>
<% if @privdir != '' and @privdir != nil -%>
$conf['file_private_path'] = '<%= @privdir %>';
$<%= @confvar_name %>['file_private_path'] = '<%= @privdir %>';
<% end -%>
<% if @local_settings.is_a? String -%>
Expand Down

0 comments on commit 8fb837a

Please sign in to comment.