Skip to content

Add provisioning filters#171

Merged
digimaun merged 13 commits into
devfrom
unknown repository
May 1, 2020
Merged

Add provisioning filters#171
digimaun merged 13 commits into
devfrom
unknown repository

Conversation

@valluriraj
Copy link
Copy Markdown
Contributor


This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Thank you for contributing to the IoT extension!

This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • If introducing new functionality or modified behavior, are they backed by unit and integration tests?
  • In the same context as above are command names and their parameter definitions accurate? Do help docs have sufficient content?
  • Have all unit and integration tests passed locally? i.e. pytest <project root> -vv
  • Have static checks passed using the .pylintrc and .flake8 rules? Look at the CI scripts for example usage.

@valluriraj valluriraj requested a review from digimaun as a code owner April 25, 2020 07:59
Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work here! I have a few notes about code organization. Nothing here seems like a blocker for internal release

Comment thread azext_iot/central/commands_device.py Outdated
Comment thread azext_iot/central/params.py Outdated
Comment thread azext_iot/central/providers/device_provider.py Outdated
Comment thread azext_iot/central/providers/device_provider.py Outdated
Comment thread azext_iot/central/providers/device_provider.py Outdated
Comment thread azext_iot/central/providers/device_provider.py Outdated
Comment thread azext_iot/central/providers/device_provider.py Outdated
Comment thread azext_iot/central/providers/device_provider.py Outdated
Comment thread azext_iot/central/providers/device_provider.py Outdated
Comment thread azext_iot/central/providers/device_provider.py
Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like its ready for some UTs and IT's, let me know if you need help writing them.

Please also attach a screenshot of all existing UT's and IT's passing.

Comment thread azext_iot/central/params.py Outdated
Comment thread azext_iot/central/providers/device_provider.py Outdated
Comment thread azext_iot/central/providers/device_provider.py
Comment thread azext_iot/central/providers/device_provider.py
Comment thread azext_iot/central/providers/device_provider.py
@valluriraj
Copy link
Copy Markdown
Contributor Author

image

Copy link
Copy Markdown

@ppathan ppathan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor changes.

def dps_populate_essential_info(self, dps_info, device_status):
error = {
"provisioned": "None",
"registered": "Device it not yet provisioned.",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: Device is not yet provisioned.

device_status=None,
):
provider = CentralDeviceProvider(cmd=cmd, app_id=app_id, token=token)
provider = CentralDeviceProvider(cmd=cmd, app_id=app_id, token=token,)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a , at the end?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use an auto-formatter called "Black", that is adding this additional comma at the end

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though in this particular case it should probably be removed

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not worry about this one. This is standard python black behavior, in this case adding a comma after the last kwarg element. If you remove it now (which is fine), the next change to this module and a re-run of the formatter would re-introduce it.

python black is an opinionated formatter with minimal configuration. Idea for using Black is to save time and mental energy for more important matters. By using it, you agree to cede control over minutiae of hand-formatting. Also Black will check that the reformatted code still produces a valid AST that is equivalent to the original. It's a relatively newer Python tool that has immense popularity in the open source world.

if not device_id:
return provider.get_all_registration_info(central_dns_suffix=central_dns_suffix)
return provider.get_all_registration_info(
central_dns_suffix=central_dns_suffix, device_status=device_status
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What pattern are we following, new line for parameter or on the same line?

Copy link
Copy Markdown

@ghost ghost Apr 30, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use an auto-formatter called "Black", that tool is deciding the spacing/line breaks for us

def dps_populate_essential_info(self, dps_info, device_status):
error = {
"provisioned": "None",
"registered": "Device it not yet provisioned.",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The registered value string has a period at the end . It would be good to standardize on ending with a period or not.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest that cleaning up error messages is a P2 since I have a task in our backlog to clean up all error messages once we are ready to ship.

Let me know if this is something PR blocking and I can work with you to resolve

)

result = self.cmd(
"iot central app device registration-info --app-id {} --ds {}".format(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have the necessary foundation in place to exercise assertions against devices with other possible device status values?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we don't, iot central creating a device doesn't actually provision it so its somewhat difficult to get the device into the other states programatically during an IT.

I'll look into this as a follow up and see if theres anything we can do

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One option is to create an app with existing devices in different states and then adding validations. IT will take dependency on external environment. Will explore other options as well.

Copy link
Copy Markdown
Member

@digimaun digimaun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging with the assumption @prbans will follow up at some point with the error message clean-up backlog task.

@digimaun digimaun merged commit 77a88ee into Azure:dev May 1, 2020
@ghost ghost deleted the add-provisioningFilters branch May 4, 2020 19:43
c-ryan-k added a commit to c-ryan-k/azure-iot-cli-extension that referenced this pull request Apr 10, 2025
* Int test updates and documentation

* Updated azure login to v2
* Updated integration test documentation
* Refactored variables to consolidate references
* Only run tox int tests on default init feature set
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