Skip to content

Conversation

@glennsarti
Copy link
Contributor

@glennsarti glennsarti commented Sep 25, 2018

The Language Server was broken for Puppet 6. This PR updates the language server for Puppet 6 support, while still supporting Puppet 4 and 5.

This PR also adds Puppet 6 to the testing matrix.

Fixes #54

@glennsarti glennsarti force-pushed the add-puppet-6 branch 3 times, most recently from 3c154fb to bad5709 Compare September 26, 2018 06:30
@glennsarti glennsarti changed the title (todo) WIP (GH-54) Support Puppet 6 in the Language Server Sep 26, 2018
With the new puppet 6.0 gem, the type loading in the Language Server no longer
worked.  This was due autoloader methods changing their method signature. Given
that this is a major version bump, breaking changes are not unexpected.  This
commit changes:
* The file loader to always pass the environment parameter. Before Puppet 6 this
  was optional, but it is now a required parameter
* The files_to_load method has changed from no parameters to one.  This commit
  modifies the call to first check the arity of the method, i.e. how many
  parameters are needed, and then modifies the file_to_load call appropriately.

  Using arity is better than checking Puppet version as it takes into account
  Puppet 7 and beyond.

Note that no test changes were made and this confirms that the language server
behaviour is the same across Puppet 4,5 and 6.
With the new puppet 6.0 gem, the function loading in the Language Server no
longer worked.  This was due autoloader methods changing their method signature
and the Puppet::Parser::Functions.environment_module(env) no longer working as
expected. Given that this is a major version bump, breaking changes are not
unexpected.  This commit changes:
* The monkey patching for functions now keeps track of which functions have
  been loaded through a simple hash table, and is accessible from
  Puppet::Parser::Functions.monkey_function_list
* The array functions filenames.uniq!.compact! could cause nils being generated.
  By changing to filenames.uniq.compact we can guarantee that an empty array
  would be generated, not nils.
* The file loader to always pass the environment parameter. Before Puppet 6 this
  was optional, but it is now a required parameter

Note that no test changes were made and this confirms that the language server
behaviour is the same across Puppet 4,5 and 6.
This commit updates the Appveyor and Travis CI configuration to test the
language server on Puppet 6 and Ruby 2.5.1.
@glennsarti glennsarti added this to the 0.15.0 milestone Oct 3, 2018
Previously Puppet 4.7 was the minimum LTS version.  However the latest version
if PE 2016.4 includes agent 4.10. This commit removes the Puppet 4.7 testing as
it is covered by the 4.x testing.
@jpogran jpogran merged commit 059a5b3 into puppetlabs:master Oct 3, 2018
@glennsarti glennsarti deleted the add-puppet-6 branch October 12, 2018 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants