Skip to content

sources/azure: refactor _should_reprovision[_after_nic_attach]() logic#1206

Merged
TheRealFalcon merged 1 commit into
canonical:mainfrom
cjp256:azure-should-reprovision-refactor
Jan 28, 2022
Merged

sources/azure: refactor _should_reprovision[_after_nic_attach]() logic#1206
TheRealFalcon merged 1 commit into
canonical:mainfrom
cjp256:azure-should-reprovision-refactor

Conversation

@cjp256
Copy link
Copy Markdown
Contributor

@cjp256 cjp256 commented Jan 21, 2022

Consolidate _should_reprovision_after_nic_attach() with
_should_reprovision() into the following:

  • _write_reprovision_marker() to write provisioning marker for
    reboot-during-provisioning case.

  • PPSType enum and _determine_pps_type() for determining which to
    provisioning mode, if any, we're running under.

PPSType.UNKNOWN is when the reprovisioning marker is found and we
do not have the context to know what the original mode was. In this
scenario, we must resort to polling for reprovision data.

Tests:

  • Introduce a simple data source fixture to for fine-grain
    control of mocking with pytest without unittest.

  • Migrate relevant _should_reprovision() tests into a combination of
    TestDeterminePPSTypeScenarios cases.

Signed-off-by: Chris Patterson cpatterson@microsoft.com

Consolidate _should_reprovision_after_nic_attach() with
_should_reprovision() into the following:

- _write_reprovision_marker() to write provisioning marker for
  reboot-during-provisioning case.

- PPSType enum and _determine_pps_type() for determining which to
  provisioning mode, if any, we're running under.

PPSType.UNKNOWN is when the reprovisioning marker is found and we
do not have the context to know what the original mode was. In this
scenario, we must resort to polling for reprovision data.

Tests:

- Introduce a simple data source fixture to for fine-grain
  control of mocking with pytest without unittest.

- Migrate relevant _should_reprovision() tests into a combination of
  TestDeterminePPSTypeScenarios cases.

Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
Copy link
Copy Markdown
Contributor

@anhvoms anhvoms left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

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

Thanks!

@TheRealFalcon TheRealFalcon merged commit 1b09576 into canonical:main Jan 28, 2022
@cjp256 cjp256 deleted the azure-should-reprovision-refactor branch April 25, 2022 16:51
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