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

Create json record that contains the generated channel ids for chef classes #323

Open
rtibbles opened this issue Mar 24, 2021 · 1 comment

Comments

@rtibbles
Copy link
Member

rtibbles commented Mar 24, 2021

Currently if the source domain or source id is not set consistently for a chef, then a ricecooker user could accidentally create a new channel rather than update their previously existing one.

To resolve this, when a chef is first run and no previous channel id is detected, then the generated channel id from the source domain and source id should be written to a module in the same folder as the chef file called channel_ids.json. This should contain the single object with key value pairs of: "<module_name + "_" + chef_class_name>": "<32 digit hex channel id>"

Where <module_name + "_" + chef_class_name> is the name of the module the chef class is defined in and the name of the class itself, joined by an underscore. This should describe a unique name within the module namespace, although someone could try to force a malicious collision by judicious use of underscores in their variable names. So be it, as it would only be an act of self harm.

In subsequent runs, ricecooker should attempt to load this JSON file, by doing a relative file load from the file that the chef is defined in. If this is defined, then the defined channel_id constant for that chef class should be cross checked against the generated channel id for the chef, based on the source domain and source id. If they do not match, the chef run should immediately abort with a loud error message informing the user to either revert the source domain and source id change, or to delete channel_ids.json, or the entry for this specific chef from channel_ids.json.

@rtibbles rtibbles changed the title Create importable python module that contains the generated channel id for a chef Create json record that contains the generated channel ids for chef classes Mar 24, 2021
@rtibbles rtibbles added this to the 0.7 milestone Mar 24, 2021
@rtibbles
Copy link
Member Author

See #203 for more historic context

@rtibbles rtibbles removed this from the 0.7 milestone Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant