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

Bug report: Some chef.help Operation Names Incompatible with chef.bake #1191

Open
penwoodjon opened this issue Mar 30, 2021 · 0 comments
Open
Labels

Comments

@penwoodjon
Copy link

penwoodjon commented Mar 30, 2021

Describe the bug
When searching for operations using the chef.help function, you can be returned an operation object that contains a name that will not work with chef.bake including the operation names 'Adler-32 Checksum', 'CRC-16 Checksum', 'CRC-32 Checksum', 'CRC-8 Checksum', 'Convert co-ordinate format', 'Find / Replace', 'Fletcher-16 Checksum', 'Fletcher-32 Checksum', 'Fletcher-64 Checksum', 'Fletcher-8 Checksum', 'HAS-160', 'Image Brightness / Contrast', 'Image Hue/Saturation/Lightness', 'Parse ASN.1 hex string', 'Parse X.509 certificate', 'Pseudo-Random Number Generator', 'TCP/IP Checksum'. If any of these operation names that can be found with the chef.help function are attempted with the chef.bake function, it will throw an error including Couldn't find an operation with name {operationName}.

To Reproduce

  1. Run the chef.bake("foobar", { op: chef.help('Adler')[0].name })

Expected behaviour
I would expect every operation name found with the chef.help function to be compatible with chef.bake

Additional context
The list above of operation names that that come from chef.help that are not compatible with chef.bake comes from the code:

chef.help(" ")
  .filter(({ name }) => { 
    try { chef.bake("asdf", { op: name });} 
    catch (e) { return e.message && e.message.includes("Couldn't find an operation with name"); }
  })
  .map(({name}) => name);

There could be more operations that have this issue as well, but the current mapping I've found that works when mapping the chef.help operation names with operation names that actually work with chef.bake are:

{
  'Adler-32 Checksum': 'adler32Checksum',
  'CRC-16 Checksum': 'CRC16Checksum',
  'CRC-32 Checksum': 'CRC32Checksum',
  'CRC-8 Checksum': 'CRC8Checksum',
  'Convert co-ordinate format': 'convertCoordinateFormat',
  'Find / Replace': 'FindReplace',
  'Fletcher-16 Checksum': 'fletcher16Checksum',
  'Fletcher-32 Checksum': 'fletcher32Checksum',
  'Fletcher-64 Checksum': 'fletcher64Checksum',
  'Fletcher-8 Checksum': 'fletcher8Checksum',
  'HAS-160': 'HAS160',
  'Image Brightness / Contrast': 'imageBrightnessContrast',
  'Image Hue/Saturation/Lightness': 'imageHueSaturationLightness',
  'Parse ASN.1 hex string': 'parseASN1HexString',
  'Parse X.509 certificate': 'parseX509Certificate',
  'Pseudo-Random Number Generator': 'pseudoRandomNumberGenerator',
  'TCP/IP Checksum': 'TCPIPChecksum'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant