GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Gateways: Confusing output for list_devices_for_gateway · Issue #1997 · GoogleCloudPlatform/python-docs-samples

Gateways: Confusing output for list_devices_for_gateway #1997

New issue
Copy link
New issue
Copy link
Closed
Closed
Gateways: Confusing output for list_devices_for_gateway#1997
Copy link
Assignees
gguuss

Description

@stevebriskin
stevebriskin
opened on Feb 5, 2019
Issue body actions

The list_devices_for_gateway function in gateway/gateway.py has a loop that isn't exercised which results in confusing output. There is no 'deviceNumIds' key in the devices dict .

In this example 'my-node-device' is bound to gateway 'testgateway'

$ python gateway.py --service_account_json XYZ.json --registry_id=my-registry --device_id=null --gateway_id=testgateway --project_id=myproject list_devices_for_gateway
Device: 2587394384972593 : my-node-device
No devices bound to gateway testgateway

The dict at devices dict is missing 'deviceNumIds'

{u'devices': [{u'numId': u'2587394384972593', u'id': u'my-node-device'}]}

Activity

  1. sgreenberg
    assigned
    gguuss
    on Jun 7, 2019
  2. gguuss commented on Jun 12, 2019

    @gguuss
    gguuss
    on Jun 12, 2019
    Contributor
    More actions

    Thanks for the heads up, what version of Python are you using? I just tested the sample and I'm seeing the following output for a gateway with no bound devices:?

    No devices bound to gateway jah
    

    A gateway with one bound device renders as:

    Device: 2658882084459077 : alpha
    

    A gateway with two bound devices renders as:

    Device: 2658882084459077 : alpha
    Device: 2765886308686097 : bleep
    
  3. gguuss commented on Jun 12, 2019

    @gguuss
    gguuss
    on Jun 12, 2019
    Contributor
    More actions

    I see what you're saying though, I'm not sure what conditions the sample is trying to resolve with the second loop or why/when the deviceNumIds dict would be populated. I'll take another look later on.

  4. gguuss commented on Aug 7, 2019

    @gguuss
    gguuss
    on Aug 7, 2019
    Contributor
    More actions

    Resolved in this PR. As you pointed out, the initial check for deviceNumIds would never be reached.

  5. gguuss
    closed this as completedon Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @gguuss
    gguuss

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.