Skip to content

Commit

Permalink
(maint) Change template to erb and fix duplicate declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
ripclawffb committed Apr 23, 2018
1 parent 64947c8 commit 27fda2b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 31 deletions.
37 changes: 10 additions & 27 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@

# disable default web site
if $disable_default_website {
iis::manage_site {'Default Web Site':
ensure => stopped,
app_pool => 'DefaultAppPool',
iis_site {'Default Web Site':
ensure => stopped,
applicationpool => 'DefaultAppPool',
require => Iis_feature['Web-WebServer'],
}
}

Expand All @@ -89,13 +90,6 @@
ensure => present,
}

# remove default web site
-> iis_site {'Default Web Site':
ensure => absent,
applicationpool => 'DefaultAppPool',
require => Iis_feature['Web-WebServer'],
}

# application in iis
-> iis_application_pool { $_chocolatey_server_app_pool_name:
ensure => 'present',
Expand Down Expand Up @@ -136,22 +130,11 @@
],
require => Package['chocolatey.server'],
}
-> acl { "${_chocolatey_server_location}/App_Data":
permissions => [
{ identity => "IIS APPPOOL\\${_chocolatey_server_app_pool_name}", rights => ['modify'] },
{ identity => 'IIS_IUSRS', rights => ['modify'] }
],
require => Package['chocolatey.server'],
}

# configure chocolatey server settings
file { "${_chocolatey_server_location}/web.config":
ensure => file,
content => epp('chocolatey_server/web.config.epp', {
'allowOverrideExistingPackageOnPush' => $allow_package_override,
'apiKey' => $apikey,
'requireApiKey' => $require_apikey,
}),
content => template('chocolatey_server/web.config.erb'),
require => Package['chocolatey.server'],
}

Expand All @@ -171,7 +154,7 @@

acl { "${_chocolatey_server_location}/App_Data":
permissions => $packages_folder_permissions,
require => [Iis::Manage_app_pool["${_chocolatey_server_app_pool_name}"],
require => [Iis_application_pool[$_chocolatey_server_app_pool_name],
File["${_chocolatey_server_location}/App_Data"],
Package['chocolatey.server']],
}
Expand All @@ -186,7 +169,7 @@
}

# ensure packages folder is created
file { "${packages_folder}":
file { $packages_folder:
ensure => directory,
}

Expand All @@ -196,13 +179,13 @@
ensure => link,
force => true,
target => $packages_folder,
require => File["${packages_folder}"],
require => File[$packages_folder],
}

# set permissions on the new packages folder
acl { "${packages_folder}":
acl { $packages_folder:
permissions => $packages_folder_permissions,
require => File["${packages_folder}"],
require => File[$packages_folder],
}
}

Expand Down
9 changes: 5 additions & 4 deletions templates/web.config.epp → templates/web.config.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%- | Boolean $allowOverrideExistingPackageOnPush, String $apiKey, Boolean $requireApiKey | -%>
<?xml version="1.0"?>
<!--
Managed by Puppet
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
Expand Down Expand Up @@ -66,12 +67,12 @@
<!--
Determines if an Api Key is required to push\delete packages from the server.
-->
<add key="requireApiKey" value="<%= $requireApiKey %>"/>
<add key="requireApiKey" value="<%= @require_apikey %>"/>
<!--
Set the value here to allow people to push/delete packages from the server.
NOTE: This is a shared key (password) for all users.
-->
<add key="apiKey" value="<%= $apiKey %>"/>
<add key="apiKey" value="<%= @apikey %>"/>
<!--
Change the path to the packages folder. Default is ~/Packages.
This can be a virtual or physical path.
Expand All @@ -81,7 +82,7 @@
Set allowOverrideExistingPackageOnPush to false if attempts to upload a package that already exists
(same id and same version) should fail.
-->
<add key="allowOverrideExistingPackageOnPush" value="<%= $allowOverrideExistingPackageOnPush %>"/>
<add key="allowOverrideExistingPackageOnPush" value="<%= @allow_package_override %>"/>
<!--
Set enableDelisting to true to enable delist instead of delete as a result of a "nuget delete" command.
- delete: package is deleted from the repository's local filesystem.
Expand Down

0 comments on commit 27fda2b

Please sign in to comment.