You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While developing the unit tests for DTT1 iteration 3 - Provision Module, I had the opportunity to review the source code thoroughly. I list the findings in this issue for discussion and triage.
The provision, testing, and allocation modules use import statements that require a PYTHONPATH environment variable of the format [wazuh-qa-repo-path]/deployability. In contrast, the workflow_engine requires the PYTHONPATH format [wazuh-qa-repo-path]/deployability/modules to work. I suggest making each module independent from the others or unifying all the modules in a single Python package.
The ProvisionHandler class constructor compares method.lower() == 'assistant'. Uppercase method names are rejected by the constructor, so it is not necessary to convert the method variable to lowercase.
The ProvisionHandler class supports the methods ['package', 'assistant', 'source'], but the ProvisionHandler ._get_templates_order function method checks for a method 'aio' that is not supported. The 'aio' method should be supported as a valid method, or it should be removed from ProvisionHandler ._get_templates_order
In the Actions class constructor, there is a variable named action_type, and an error message f"Unsupported action_type: {action_type}". The validation and the assignment are related to component types. I suggest changing the variable name to component_type and the error message to Unsupported component_type.
The playbook parameter of the Ansible.run_playbook type is str | Path. In the Actions.execute method, I've seen that the run_playbook method has a dict as the playbook parameter. I suggest updating the type to dict | str | Path.
Four instance variables are in the ComponentType class, but only two are typed. I suggest typing all the instance variables.
The provision.update_status variable is not a dict but a runner instance of the Ansible package.
The @classmethods decorator must be added to all the validator functions, for example, here:
Description
While developing the unit tests for DTT1 iteration 3 - Provision Module, I had the opportunity to review the source code thoroughly. I list the findings in this issue for discussion and triage.
The provision, testing, and allocation modules use
import
statements that require aPYTHONPATH
environment variable of the format[wazuh-qa-repo-path]/deployability
. In contrast, theworkflow_engine
requires the PYTHONPATH format[wazuh-qa-repo-path]/deployability/modules
to work. I suggest making each module independent from the others or unifying all the modules in a single Python package.The ProvisionHandler class constructor compares
method.lower() == 'assistant'
. Uppercase method names are rejected by the constructor, so it is not necessary to convert the method variable to lowercase.The ProvisionHandler class supports the methods
['package', 'assistant', 'source']
, but theProvisionHandler ._get_templates_order
function method checks for a method 'aio' that is not supported. The 'aio' method should be supported as a valid method, or it should be removed fromProvisionHandler ._get_templates_order
In the Actions class constructor, there is a variable named
action_type
, and an error messagef"Unsupported action_type: {action_type}"
. The validation and the assignment are related to component types. I suggest changing the variable name tocomponent_type
and the error message to Unsupported component_type.The
playbook
parameter of theAnsible.run_playbook
type isstr | Path
. In theActions.execute
method, I've seen that therun_playbook
method has adict
as the playbook parameter. I suggest updating the type todict | str | Path.
Four instance variables are in the
ComponentType
class, but only two are typed. I suggest typing all the instance variables.The
provision.update_status
variable is not adict
but arunner
instance of theAnsible
package.The @classmethods decorator must be added to all the validator functions, for example, here:
wazuh-qa/deployability/modules/provision/models.py
Lines 60 to 66 in 4110dad
The @validator is marked as deprecated and will be removed in the next pydantic version. We must implement @field_validator instead.
Fix the typo
recived
:wazuh-qa/deployability/modules/provision/models.py
Line 35 in 4110dad
Fix this message, changing
provisionment
to 'provisioning'wazuh-qa/deployability/modules/provision/provision.py
Line 41 in 4110dad
The text was updated successfully, but these errors were encountered: