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

Parsing default plan values is strange #1854

Closed
donoghuc opened this issue May 27, 2020 · 6 comments
Closed

Parsing default plan values is strange #1854

donoghuc opened this issue May 27, 2020 · 6 comments
Labels
Bug Bug reports and fixes. Stale Issues and PRs that haven't had activity in 60 days.

Comments

@donoghuc
Copy link
Contributor

Describe the Bug

There is some strangeness how puppet-strings/YARD parses default plan parameters. The following plan shows some of the discrepensies:

plan test::parsing(
	$bare = bare,
	$single = 'single',
	$double = "double",
	$arithmetic = 1 + 1,
	$code = Target.new('foo')
){}
cas@cas-ThinkPad-T460p:~/working_dir/bolt$ bolt plan show test::parsing

test::parsing

USAGE:
bolt plan run test::parsing [bare=<value>] [single=<value>] [double=<value>] [arithmetic=<value>] [code=<value>]

PARAMETERS:
- bare: Any
    Default: bare
- single: Any
    Default: 'single'
- double: Any
    Default: "double"
- arithmetic: Any
    Default: +
- code: Any
    Default: ('foo')

MODULE:
/home/cas/working_dir/bolt/Boltdir/site/test

Expected Behavior

Some of those appear to be bugs, Others (like the quoting of strings) is maybe right? Either way it appears to be kind of strange.

Additional context

We are looking at displaying default values in the PE console.

@donoghuc donoghuc added the Bug Bug reports and fixes. label May 27, 2020
@adreyer
Copy link
Contributor

adreyer commented Jun 3, 2020

We shouldn't invest a huge amount of time in this right now if we discover it's a hard fix.

@npwalker
Copy link
Contributor

npwalker commented Jun 3, 2020

I thought adding parens around 1+1 might help but it just returns (.

MacBook-Pro:myboltproj nw$ /opt/puppetlabs/bin/bolt plan show myboltproj::parsing
Concurrency will default to 85 because ulimit is low: 256. Set concurrency with '--concurrency', or set your ulimit with 'ulimit -n <limit>'

myboltproj::parsing

USAGE:
bolt plan run myboltproj::parsing [bare=<value>] [single=<value>] [double=<value>] [arithmetic=<value>] [code=<value>]

PARAMETERS:
- bare: Any
    Default: bare
- single: Any
    Default: 'single'
- double: Any
    Default: "double"
- arithmetic: Integer
    Default: (
- code: Any
    Default: ('foo')

MODULE:
/Users/nw/myboltproj
MacBook-Pro:myboltproj nw$ cat plans/parsing.pp
plan myboltproj::parsing(
	$bare = bare,
	$single = 'single',
	$double = "double",
	Integer $arithmetic = (1 + 1),
	$code = Target.new('foo')
){}

@nicklewis
Copy link
Contributor

This appears to be an issue with the SourcePosAdapter in Puppet that is used by puppet-strings. When given an AST node with children, it only extracts the text for the parent node.

This appears to be an existing issue in puppet-strings that also affects how classes and defines are parsed.

@nicklewis nicklewis self-assigned this Jun 4, 2020
@nicklewis
Copy link
Contributor

nicklewis commented Jun 15, 2020

As this is an existing (not plan specific) bug in puppet-strings, I've filed puppetlabs/puppet-strings#240 to track the issue there.

@nicklewis nicklewis removed their assignment Jun 15, 2020
@github-actions
Copy link

This issue has not had activity for 60 days and will be marked as stale.
If this issue continues to have no activity for 7 days, it will be closed.

@github-actions github-actions bot added the Stale Issues and PRs that haven't had activity in 60 days. label Jul 29, 2022
@github-actions
Copy link

github-actions bot commented Aug 6, 2022

This issue is stale and has been closed. If you believe this is in error,
or would like the Bolt team to reconsider it, please reopen the issue.

@github-actions github-actions bot closed this as completed Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug reports and fixes. Stale Issues and PRs that haven't had activity in 60 days.
Projects
None yet
Development

No branches or pull requests

4 participants