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

tools: Port, debug, and document createIoTThings.py #82

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

RC-Repositories
Copy link
Contributor

The script contains tools used to create, destroy, and manage AWS IoT Things, Policies, Buckets, Roles, and Jobs. It is intended to automate the process of creating an OTA update.

Documentation for the script was also added at
docs/components/aws_iot/aws_tool.md``. This commit links to this documentation in the top-level README.md`, under a new section called 'Tools'.

This commit stores generated credentials for new objects in the credentials directory by default, with unique file names per Thing.
The user can optionally specify the credentials directory.

It is possible to do any operation except for an OTA image update if update-signature.txt is not in the correct directory. A warning is generated if update-signature.txt is not present.

This script updates
/applications/<target_application>/configs/aws_config/aws_clientcredentials.h once a Thing is created, where <target_application> is specified on the CLI. If the file has been previously modified, it asks before overwriting.
This saves the user modifying the file.

Description

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

The script contains tools used to create, destroy, and manage AWS IoT
Things, Policies, Buckets, Roles, and Jobs. It is intended to
automate the process of creating an OTA update.
The script was previously in a deprecated project.

Documentation for the script was also ported to
`/docs/components/aws_iot/aws_tool.md``.
Modified the aws_tool.md file with the following:
1. Fix paths from total-solutions.
2. Remove deprecated references (e.g. ats.sh)
3. Clarifications added (e.g. where to get AWS API keys).
4. Remove duplicate sections that have been ported already.

This commit links to this documentation in the top-level `README.md`,
under a section called 'Tools'.

Modified createIoTThings.py with the following:
1. comment all functions with Python Docstrings.
2. debug and refactor createIoTThings.py as detailed below.
3. Fix filenames and directories from deprecated total-solutions.

Total-solutions saved all credentials to the same .h file, but build.sh
in this project takes credentials from separate files.
This commit stores generated credentials for new objects in
the `credentials` directory by default, with unique file names per
Thing.
The user can optionally specify the credentials directory.

This commit makes it possible to do any operation except for an OTA
image update if update-signature.txt is not in the correct directory.
A warning is generated if update-signature.txt is not present.

This commit improves --help messages for the script.

This commit places additional user input checks e.g.
permissions_boundary must be of a certain format. Previous error
messages were confusing.

fix: does not forget to pass role name during role creation.
fix: _does_role_exist handles None and "" cases.
fix: cleanup after command failure. Do not delete a role if it already
existed before the script ran.
fix: create-update-only now gets role ARNs correctly.
fix: create-policy-only now passes thing name and policy name correctly.
fix: create-policy-only does not allow empty policy name or thing name.
fix: correct help messages e.g. for create-update-only.
Some other minor fixes also exist.

This script updates
`/applications/<target_application>/configs/aws_config/
aws_clientcredentials.h` once a Thing is created, where
`<target_application>` is specified on the CLI. If the file has been
previously modified, the script asks before overwriting.
This saves the user modifying the file.

Signed-off-by: Reuben Cartwright <[email protected]>
@RC-Repositories RC-Repositories requested a review from a team as a code owner August 22, 2024 08:31
@urutva urutva merged commit d20b8f4 into FreeRTOS:main Aug 22, 2024
16 checks passed
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

Successfully merging this pull request may close these issues.

3 participants