Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add specification of a custom cookiecutter template for role creation (…
…#1647) * Adds vscode setting folder to gitignore Signed-off-by: Alexis Lessard <[email protected]> * Allows specification of custom cookiecutter template for role The molecule and test folder are still created. New fixtures that create a temporary template folder have also been added. That way, tests aren't dependent on other files present in the test directory. Signed-off-by: Alexis Lessard <[email protected]> * Adds failsafe for absent template directory Signed-off-by: Alexis Lessard <[email protected]> * Adds failsafe agains invalid cookiecutter templates If a cookiecutter exception is raised, it will trigger a sysexit with the appropriate message. Maybe a try except is not the best way to deal with this scenario, but I havent been able to figure out how to validate the template before the execution of cookiecutter Signed-off-by: Alexis Lessard <[email protected]> * Adds option to role command for a cookicutter template Signed-off-by: Alexis Lessard <[email protected]> * Cleans the code according to linting rules This commit corrected those errors, as shown on travis: ./molecule/command/init/role.py:69: [E501] line too long (87 > 79 characters) ./molecule/command/init/role.py:117: [E231] missing whitespace after ',' ./molecule/command/init/role.py:117: [E231] missing whitespace after ',' ./molecule/command/init/role.py:117: [E231] missing whitespace after ',' ./molecule/command/init/role.py:118: [E501] line too long (124 > 79 characters) ./molecule/command/init/role.py:120: [E231] missing whitespace after ',' ./molecule/command/init/role.py:141: [W293] blank line contains whitespace ./test/unit/command/init/test_role.py:54: [E501] line too long (96 > 79 characters) ./test/unit/command/init/test_role.py:56: [E302] expected 2 blank lines, found 1 ./test/unit/command/init/test_role.py:58: [E501] line too long (80 > 79 characters) ./test/unit/command/init/test_role.py:60: [E302] expected 2 blank lines, found 1 ./test/unit/command/init/test_role.py:60: [E231] missing whitespace after ',' ./test/unit/command/init/test_role.py:60: [E231] missing whitespace after ',' ./test/unit/command/init/test_role.py:63: [E501] line too long (86 > 79 characters) ./test/unit/command/init/test_role.py:85: [E501] line too long (82 > 79 characters) ./test/unit/command/init/test_role.py:90: [E302] expected 2 blank lines, found 1 ./test/unit/command/init/test_role.py:118: [E501] line too long (122 > 79 characters) ./test/unit/command/init/test_role.py:133: [E501] line too long (88 > 79 characters) ./test/unit/command/init/test_role.py:143: [E302] expected 2 blank lines, found 1 ./test/unit/command/init/test_role.py:143: [E501] line too long (103 > 79 characters) ./test/unit/command/init/test_role.py:149: [W293] blank line contains whitespace ./test/unit/command/init/test_role.py:150: [W391] blank line at end of file Signed-off-by: Alexis Lessard <[email protected]> * Adds a custom role template Signed-off-by: Alexis Lessard <[email protected]> * Adds an invalid template dir Signed-off-by: Alexis Lessard <[email protected]> * Refactors tests to use fixed templates Signed-off-by: Alexis Lessard <[email protected]> I've discovered that some resources were available for tests, so I've added two more, which are two cookiecutter templates: One is valid, the other one is not. Signed-off-by: Alexis Lessard <[email protected]> * Modifies path of incorrect_path Since we can't use "temp_dir" as a path, apparently, the incorrect path will just be absent directory wherever we are. Doesn't matter anyway, we want to see how the code reacts when the folder doesnt exist. Signed-off-by: Alexis Lessard <[email protected]> * Corrects the code style This also deletes the _generate_template_dir function, wich is now useless. I forgot to delete it in a previous commit. Signed-off-by: Alexis Lessard <[email protected]> * corrects test_role according to linting test Signed-off-by: Alexis Lessard <[email protected]> * Corrects a spelling mistake in the init role command description Signed-off-by: Alexis Lessard <[email protected]> * Adds the path of the problematic template inside the error message Signed-off-by: Alexis Lessard <[email protected]> Tests have also been updated, altough they could assert the error message contains the path of the folder. Don't know how to test that yet, tough... Signed-off-by: Alexis Lessard <[email protected]> * Cleans code according to linting and formating rules Signed-off-by: Alexis Lessard <[email protected]> * Adds documentation about the template option Signed-off-by: Alexis Lessard <[email protected]> * Cleans the code according to linting rules Signed-off-by: Alexis Lessard <[email protected]> * Modify init role documentation to scenario relations Signed-off-by: Alexis Lessard <[email protected]> Also modifies the scenario documentation to include information about cookiecutter, specifying that a scenario includes the default cookicutter template. Signed-off-by: Alexis Lessard <[email protected]> * Corrects the code style Signed-off-by: Alexis Lessard <[email protected]> * Removes a trailing whitespace Signed-off-by: Alexis Lessard <[email protected]> * Corrects code style Signed-off-by: Alexis Lessard <[email protected]> * Revert "Adds vscode setting folder to gitignore" and changes ``init role`` documentation This reverts commit e306961. It also makes a change for a change request by @wilmardo. I forgot to sign it off, so I'm fusing those commits. Signed-off-by: Alexis Lessard <[email protected]> * Clarifies the origin of the molecule folder added to the template The upstream molecule folder (the default one with init role) is added. Signed-off-by: Alexis Lessard <[email protected]>
- Loading branch information