-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
@aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudRelated to Amazon Elastic Compute CloudbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp1
Description
Describe the bug
using ec2.InitCommand.argvCommand() can, in some circumstances, remove duplicate strings from the input array, causing unexpected output.
Expected Behavior
Expected the following
ec2.InitCommand.argvCommand([
'useradd', '-u', '1001', '-g', '1001', 'eguser',
]),
ec2.InitCommand.argvCommand([
'useradd', '-a', '-u', '1001', '-g', '1001', 'eguser',
]),To generate the following YAML:
commands:
"000":
command:
- useradd
- -u
- "1001"
- -g
- "1001"
- eguser
"001":
command:
- useradd
- -a
- -u
- "1001"
- -g
- "1001"
- eguserCurrent Behavior
The following YAML was generated. Note the omission of the second occurrence of '1001' in the second command:
commands:
"000":
command:
- useradd
- -u
- "1001"
- -g
- "1001"
- eguser
"001":
command:
- useradd
- -a
- -u
- "1001"
- -g
- eguserReproduction Steps
The CDK App in the provided repo contains the minimal resources needed to demonstrate the bug when running cdk synth:
https://github.com/fidothe/cdk-ec2-construct-bug-repro
git clone https://github.com/fidothe/cdk-ec2-construct-bug-repro && cd cdk-ec2-construct-bug-repro && cdk synth
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.85.0 (build 4e0d726)
Framework Version
No response
Node.js Version
v18.16.1
OS
macOS 13.4.1
Language
Typescript
Language Version
Typescript (5.1.5)
Other information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudRelated to Amazon Elastic Compute CloudbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp1