-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(WIP) (CONT-333) Ensure get_title_tokens func only gets resource titles
Prior to this commit, the get_title_tokens function searched all tokens to find a :COLON token. It then assumed that the tokens preceding this were the title definition of a resource. This resulted in undesirable behaviour as it would not work if e.g. a case statement was found; no title would be found. Furthermore, titles of known puppet resources is all that this function should be grabbing, instead of anything preceding a :COLON. Therefore, it is a more robust approach to first find a resource definition, like an exec, and then look for a title declaration following this. This is what this commit attempts to achieve. get_title_tokens is now get_exec_titles which now only gets exec titles and therefore does not return the resource type. Since only an array of tokens is returned now, get_exec_titles returns an array instead of a hash of arrays. Adding spec test to unsure problems encountered with case statements is avoided in future.
- Loading branch information
Showing
2 changed files
with
48 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters