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

How to change the ComputerSystem.Status property when performing a ResetAction #96

Open
jcleung5549 opened this issue Mar 22, 2021 · 1 comment

Comments

@jcleung5549
Copy link
Contributor

The emulation code for the ./Systems/{id}/ResetAction resource in located in the file ./api_emulator/redfish/ComputerSystem/ResetAction.py. A behavior of a reset action is to change the ComputerSystem.Status.State property. However, this requires the code import a module within the ComputerSystem.py code in the parent directory. Python 3.3 removed relative imports, so imports from a parent directory requires hacking PYTHONPATH or adding the parent-path to sys.path.

There is a request for a cleaner way.

@jcleung5549
Copy link
Contributor Author

The construct of the folders is to have a resource.py and resource_api.py code in ./redfish and the template files (resource_template.py) in the directory ./redfish/templates. This allowed the resource behavior code to import from each other modules from each other within their scope (and avoid running afoul with recursive imports). The creation of the ./redfish/ComputerSystem directory violates the above construct.

The fix is to move to resource.py, resource_api,py resource_template.py files to their proper directory and remove the ./ComputerSystem directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant