magma icon indicating copy to clipboard operation
magma copied to clipboard

chore: Clean up boolean arguments in fabfiles

Open vktng opened this issue 2 years ago • 12 comments

Signed-off-by: Krisztián Varga [email protected]

Summary

In fabfiles the boolean arguments were not standardized. Calling a fabric function from the command line with a boolean argument will pass a string to it. This PR ensures that all of the public functions expect string-boolean values and only use them for conditions if they have been converted to boolean. This closes #14031.

Additionally, the distutils.util.strtobool function will be deprecated in Python v3.10, therefore a new converter function was created. For more information see: https://peps.python.org/pep-0632/

Test Plan

CI.

Additional Information

  • [ ] This change is backwards-breaking

vktng avatar Sep 28 '22 14:09 vktng

Thanks for opening a PR! :100:

A couple initial guidelines

Howto

  • Reviews. The "Reviewers" listed for this PR are the Magma maintainers who will shepherd it.
  • Checks. All required CI checks must pass before merge.
  • Merge. Once approved and passing CI checks, use the ready2merge label to indicate the maintainers can merge your PR.

More info

Please take a moment to read through the Magma project's

If this is your first Magma PR, also consider reading

github-actions[bot] avatar Sep 28 '22 14:09 github-actions[bot]

feg-workflow

    2 files  203 suites   40s :stopwatch: 374 tests 374 :heavy_check_mark: 0 :zzz: 0 :x: 388 runs  388 :heavy_check_mark: 0 :zzz: 0 :x:

Results for commit 872cca51.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Sep 28 '22 14:09 github-actions[bot]

dp-workflow

14 tests   14 :heavy_check_mark:  2m 14s :stopwatch:   1 suites    0 :zzz:   1 files      0 :x:

Results for commit 872cca51.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Sep 28 '22 14:09 github-actions[bot]

agw-workflow

615 tests   611 :heavy_check_mark:  3m 43s :stopwatch:     2 suites      4 :zzz:     2 files        0 :x:

Results for commit 872cca51.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Sep 28 '22 15:09 github-actions[bot]

There is still the issue with clear_orc8r and some other variables in lte/gateway/python/integ_tests/federated_tests/fabfile.py. Those variables are not converted to booleans at the moment.

MoritzThomasHuebner avatar Sep 29 '22 00:09 MoritzThomasHuebner

There is still the issue with clear_orc8r and some other variables in lte/gateway/python/integ_tests/federated_tests/fabfile.py. Those variables are not converted to booleans at the moment.

Yes, I missed clear_orc8r and the deletion of line 344, but I don't see anything else. All others are used as strings and/or converted to bool when needed.

vktng avatar Sep 29 '22 08:09 vktng

Make it sense to replace strtobool by another one maybe self-written, because the function is deprecated since Python 3.10 and will be deleted in 3.12. (PEP-0632)

ajahl avatar Sep 29 '22 09:09 ajahl

Make it sense to replace strtobool by another one maybe self-written, because the function is deprecated since Python 3.10 and will be deleted in 3.12. (PEP-0632)

It will be available in the setuptools package instead, can't we just use that one? IMO writing an existing function again is not the best solution.

vktng avatar Sep 29 '22 10:09 vktng

Make it sense to replace strtobool by another one maybe self-written, because the function is deprecated since Python 3.10 and will be deleted in 3.12. (PEP-0632)

It will be available in the setuptools package instead, can't we just use that one? IMO writing an existing function again is not the best solution.

I think strtobool won't be moved there and they say "you will need to reimplement the functionality yourself" in the link. We might want to use an easier version of the function though. (In any case, it will only be a problem in Python 3.12 so it's optional in this PR. But we could already consider changing it to be future-proof.)

sebathomas avatar Sep 30 '22 13:09 sebathomas

Make it sense to replace strtobool by another one maybe self-written, because the function is deprecated since Python 3.10 and will be deleted in 3.12. (PEP-0632)

It will be available in the setuptools package instead, can't we just use that one? IMO writing an existing function again is not the best solution.

I think strtobool won't be moved there and they say "you will need to reimplement the functionality yourself" in the link. We might want to use an easier version of the function though. (In any case, it will only be a problem in Python 3.12 so it's optional in this PR. But we could already consider changing it to be future-proof.)

I did not notice that this function was mentioned there by name. I will try to create something light to replace it.

vktng avatar Oct 04 '22 07:10 vktng

Oops! Looks like you failed the Python Format Check.

Howto

:recycle: Updated: :white_check_mark: The check is passing the Python Format Check after the last commit.

github-actions[bot] avatar Oct 05 '22 11:10 github-actions[bot]

cloud-workflow

1 135 tests   1 135 :heavy_check_mark:  2m 15s :stopwatch:    365 suites         0 :zzz:        7 files           0 :x:

Results for commit 872cca51.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Oct 05 '22 11:10 github-actions[bot]

Oops! Looks like you failed the DCO check. Be sure to sign all your commits.

Howto

:recycle: Updated: :white_check_mark: The check is passing the DCO check after the last commit.

github-actions[bot] avatar Oct 06 '22 13:10 github-actions[bot]