voxpupuli / puppet-windowsfeature

Library that uses ServerAdministration api that comes with Windows Server 2008 and Windows Server 2012 to add / remove windows features
https://forge.puppet.com/puppet/windowsfeature
MIT License
30 stars 50 forks source link

feature_name errors with arrays #30

Closed steve-hawkins closed 7 years ago

steve-hawkins commented 9 years ago

I've tried several attempts to get the feature_name attribute to accept an array, but even using the 'IIS' example straight from the Puppet forge documentation I get the following error : -

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Unknown function suffix at /etc/puppetlabs/puppet/modules/windowsfeature/manifests/in
it.pp:93 on node hxb30237.hiscox.nonprod
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

This is when using Puppet Enterprise 3.2 and the agent is running on a Windows Server 2012 R2

Here are the examples I have tried : -

  windowsfeature { 'PowerShell':
    ensure       => present,
    feature_name => [
      'PowerShellRoot',
      'PowerShell',
      'PowerShell-V2',
      'PowerShell-ISE',
    ],
    require => windowsfeature['NET-Framework-Core'],
  }
  windowsfeature { 'Test':
    feature_name => [
      'PowerShellRoot',
      'PowerShell',
      'PowerShell-V2',
      'PowerShell-ISE'
    ]
  }
  windowsfeature { 'IIS':
    feature_name => [
      'Web-Server',
      'Web-WebServer',
      'Web-Asp-Net45',
      'Web-ISAPI-Ext',
      'Web-ISAPI-Filter',
      'NET-Framework-45-ASPNET',
      'WAS-NET-Environment',
      'Web-Http-Redirect',
      'Web-Filtering',
      'Web-Mgmt-Console',
      'Web-Mgmt-Tools'
    ]
  }

Line 93:

$escaped = join(prefix(suffix($feature_name,'\''),'\''),',')

Dependencies are covered:

puppetlabs-stdlib (v3.2.0) puppetlabs-powershell (v1.0.3)

cyberious commented 9 years ago

@hawky84 looks like this is improperly pinned to STDLIB 3.2.0 and if you look a the api's available to stdlib 3.2.0 there is no function called suffix until 4.0, we have one of two ways forward either remove the older dependency of 3.2.0 and bump to 4.0 which would require a major version bump or a function that would do this work instead of depending on stdlib

cyberious commented 9 years ago

@liamjbennett

liamjbennett commented 9 years ago

I'd go with the stdlib update. We should probably have done this a long time ago anyway so this is a good excuse.

cyberious commented 9 years ago

@liamjbennett took a quick stab at a Type and Provider change for this as well, will work on more but https://github.com/cyberious/puppet-windowsfeature/blob/Function/lib/puppet/provider/windowsfeature/powershell.rb

cyberious commented 9 years ago

It is ugly so far I warn you

liamjbennett commented 9 years ago

Nice. I'll try and build up the beaker tests so that we can make changes like that.

cyberious commented 8 years ago

Well I have been unable to get back to this clearly.

TraGicCode commented 7 years ago

Closing as this as the feature_name attribute no longer exists when this got converted to a custom type.