Skip to content

Fix the local variable 'dut_port' referenced before assignment#7512

Merged
yaqiangz merged 1 commit intosonic-net:masterfrom
nhe-NV:fix_UnboundLocalError_issue
Feb 22, 2023
Merged

Fix the local variable 'dut_port' referenced before assignment#7512
yaqiangz merged 1 commit intosonic-net:masterfrom
nhe-NV:fix_UnboundLocalError_issue

Conversation

@nhe-NV
Copy link
Contributor

@nhe-NV nhe-NV commented Feb 18, 2023

In ptfhost_utils.py, after PR #7079 merged, there is exception "UnboundLocalError: local variable 'dut_port' referenced before assignment"

Description of PR

Summary: In ptfhost_utils.py, after PR #7079 merged, there is exception "UnboundLocalError: local variable 'dut_port' referenced before assignment"
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012
  • 202205

Approach

What is the motivation for this PR?

How did you do it?

Fix the local variable 'dut_port' referenced before assignment

How did you verify/test it?

Run the test case which has such failure, and it pass.

Any platform specific information?

No

Supported testbed topology if it's a new test case?

Documentation

@nhe-NV
Copy link
Contributor Author

nhe-NV commented Feb 20, 2023

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Blueve
Blueve previously approved these changes Feb 20, 2023
@Blueve
Copy link
Collaborator

Blueve commented Feb 20, 2023

@vmittal-msft for awareness

@yaqiangz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@StormLiangMS
Copy link
Collaborator

@nhe-NV test failed when call into the pthost_utils, could you check?

@nhe-NV
Copy link
Contributor Author

nhe-NV commented Feb 21, 2023

@nhe-NV test failed when call into the pthost_utils, could you check?

I will check, thanks

@yaqiangz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

yaqiangz
yaqiangz previously approved these changes Feb 22, 2023
@yaqiangz
Copy link
Contributor

@nhe-NV Could you please resolve conflicts between this PR and master branch?

@nhe-NV
Copy link
Contributor Author

nhe-NV commented Feb 22, 2023

@yaqiangz conflict resolved

Copy link
Contributor

Choose a reason for hiding this comment

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

This is where it conflicted with another PR before

Copy link
Contributor

Choose a reason for hiding this comment

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

This is where it conflicted with another PR before

@yaqiangz
Copy link
Contributor

yaqiangz commented Feb 22, 2023

@yaqiangz conflict resolved

Hi @nhe-NV I found that there are two place ((comment in code)) conflicted with this PR merged no long ago https://github.com/sonic-net/sonic-mgmt/pull/7385/files#diff-c7cac5f14c557607cbbd06fd58b784e8421c24354a06adb306b64a7e9dc73601. But your PR just overwrote it. No sure whether it would cause problem. Have you verified that?

In ptfhost_utils.py, after PR sonic-net#7079 merged, there is exception "UnboundLocalError: local variable 'dut_port' referenced before assignment"
@nhe-NV nhe-NV force-pushed the fix_UnboundLocalError_issue branch from 6e713f2 to 7f64e6c Compare February 22, 2023 02:55
@nhe-NV
Copy link
Contributor Author

nhe-NV commented Feb 22, 2023

@yaqiangz conflict resolved

Hi @nhe-NV I found that there are two place ((comment in code)) conflicted with this PR merged no long ago https://github.com/sonic-net/sonic-mgmt/pull/7385/files#diff-c7cac5f14c557607cbbd06fd58b784e8421c24354a06adb306b64a7e9dc73601. But your PR just overwrote it. No sure whether it would cause problem. Have you verified that?

I did not notice there is real code change in this line, thought it is only the pre-commit issue.
now updated it.

@yaqiangz yaqiangz merged commit f41d27a into sonic-net:master Feb 22, 2023
wangxin pushed a commit that referenced this pull request Feb 23, 2023
In ptfhost_utils.py, after PR #7079 merged, there is exception "UnboundLocalError: local variable 'dut_port' referenced before assignment"

How did you do it?
Fix the local variable 'dut_port' referenced before assignment

How did you verify/test it?
Run the test case which has such failure, and it pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants