Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(GH-137) Load Puppet Custom Types, Defined Types and Classes via Puppet API v4 #138

Conversation

glennsarti
Copy link
Contributor

@glennsarti glennsarti commented Jun 2, 2019

Builds on #126 - Merged

Fixes #137


Now that there is a puppetstrings feature flag, we can change the loading
behaviour of the Custom Types to use the newer loader and Puppet Strings
metadata evaluation. This commit;

  • Adds Custom Types ('type') ability to the retrieve_via_puppet_strings method

  • Custom Types loading isn't fully implemented like Puppet Functions are, in
    particular there's no use of the Smart Paths, and the loader still uses the
    old autoload methods. To work around this a new loader is created, which is
    based on the the NullLoader. It's purpose is to only support the needed
    discover_path method, however as it's a NullLoader, it won't actually load
    anything if it's called by Puppet.

    This loader calls the old autoloader using the same logic we used previously
    but surfaced via the loader.

  • Just like the previous loading mechanism, the whit and component types are
    ignored.

  • The Puppet Strings helper is updated to support reading the type data from
    Puppet Strings. Note that class documentation is now available whereas
    in the current iteration of the sidecar it is not.

  • The integration tests were updated to test for the new information and that
    the data can be cached correctly.


Now that there is a puppetstrings feature flag, we can change the loading
behaviour of Puppet Classes and Defined Types to use the newer loader and
Puppet Strings metadata evaluation. This commit;

  • Uses a "fake" object type called sidecar_manifest to interrogate the loaders
    for the information. This is because there's no type name in the loaders
    which suits our needs. By using such a strict name we can be sure that the
    default loaders will just ignore it.
  • The PathDiscoveryNullLoader is updated to discover all of the paths to the
    manifests in the environment.
  • The Puppet Strings helper is updated to support reading the type data from
    Puppet Strings. Note that class documentation is now available whereas
    in the current iteration of the sidecar it is not.
  • The integration tests were updated to test for the new information and that
    the data can be cached correctly.

@glennsarti glennsarti self-assigned this Jun 2, 2019
@glennsarti glennsarti added enhancement New feature or request Language Server labels Jun 2, 2019
@glennsarti glennsarti added this to the 0.20.0 milestone Jun 2, 2019
@glennsarti
Copy link
Contributor Author

Blocked on merge for #126

@glennsarti glennsarti changed the title {BLOCKED}(GH-137) Load Puppet Custom Types, Defined Types and Classes via Puppet API v4 (GH-137) Load Puppet Custom Types, Defined Types and Classes via Puppet API v4 Jun 6, 2019
Now that there is a puppetstrings feature flag, we can change the loading
behaviour of the Custom Types to use the newer loader and Puppet Strings
metadata evaluation.  This commit;

* Adds Custom Types ('type') ability to the retrieve_via_puppet_strings method
* Custom Types loading isn't fully implemented like Puppet Functions are, in
  particular there's no use of the Smart Paths, and the loader still uses the
  old autoload methods.  To work around this a new loader is created, which is
  based on the the NullLoader.  It's purpose is to only support the needed
  discover_path method, however as it's a NullLoader, it won't actually load
  anything if it's called by Puppet.

  This loader calls the old autoloader using the same logic we used previously
  but surfaced via the loader.
* Just like the previous loading mechanism, the whit and component types are
  ignored.
* The Puppet Strings helper is updated to support reading the type data from
  Puppet Strings.  Note that class documentation is now available whereas
  in the current iteration of the sidecar it is not.
* The integration tests were updated to test for the new information and that
  the data can be cached correctly.
…trings

Now that there is a puppetstrings feature flag, we can change the loading
behaviour of Puppet Classes and Defined Types to use the newer loader and
Puppet Strings metadata evaluation.  This commit;

* Uses a "fake" object type called sidecar_manifest to interrogate the loaders
  for the information.  This is because there's no type name in the loaders
  which suits our needs.  By using such a strict name we can be sure that the
  default loaders will just ignore it.
* The PathDiscoveryNullLoader is updated to discover all of the paths to the
  manifests in the environment.
* The Puppet Strings helper is updated to support reading the type data from
  Puppet Strings.  Note that class documentation is now available whereas
  in the current iteration of the sidecar it is not.
* The integration tests were updated to test for the new information and that
  the data can be cached correctly.
@glennsarti glennsarti force-pushed the gh-137-use-strings-to-extract-types-classes branch from 62d7669 to c0c7431 Compare June 6, 2019 02:22
autoloader = Puppet::Util::Autoload.new(self, 'puppet/type')
current_env = current_environment

# This is an expensive call
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: this is in the wrong spot.

@michaeltlombardi michaeltlombardi merged commit 655eeab into puppetlabs:master Jun 6, 2019
@glennsarti glennsarti deleted the gh-137-use-strings-to-extract-types-classes branch June 6, 2019 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Language Server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Puppet4API Project Task 4-6] Load Puppet Custom Types, Defined Types and Classes via Puppet API v4
2 participants