Merge ~raharper/curtin:fix/preserve-disk-no-ptable into curtin:master

Proposed by Ryan Harper
Status: Merged
Approved by: Ryan Harper
Approved revision: 4f9731e403347b413af9b722a62861cf32a3dc84
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~raharper/curtin:fix/preserve-disk-no-ptable
Merge into: curtin:master
Diff against target: 26 lines (+2/-2)
2 files modified
curtin/commands/block_meta.py (+1/-1)
tests/unittests/test_commands_block_meta.py (+1/-1)
Reviewer Review Type Date Requested Status
Dan Watkins (community) Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+382441@code.launchpad.net

Commit message

block-meta: Don't check the ptable type of a disk with no ptable

When re-using a disk without a partition table we do not need to check
the current partition table.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Dan Watkins (oddbloke) wrote :

LGTM, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/curtin/commands/block_meta.py b/curtin/commands/block_meta.py
2index 6c145e3..484da41 100644
3--- a/curtin/commands/block_meta.py
4+++ b/curtin/commands/block_meta.py
5@@ -560,7 +560,7 @@ def disk_handler(info, storage_config):
6 disk = get_path_to_storage_volume(info.get('id'), storage_config)
7 if config.value_as_boolean(info.get('preserve')):
8 # Handle preserve flag, verifying if ptable specified in config
9- if ptable != PTABLE_UNSUPPORTED:
10+ if ptable and ptable != PTABLE_UNSUPPORTED:
11 current_ptable = block.get_part_table_type(disk)
12 LOG.debug('disk: current ptable type: %s', current_ptable)
13 if current_ptable not in PTABLES_SUPPORTED:
14diff --git a/tests/unittests/test_commands_block_meta.py b/tests/unittests/test_commands_block_meta.py
15index 7b4f99c..2622a6d 100644
16--- a/tests/unittests/test_commands_block_meta.py
17+++ b/tests/unittests/test_commands_block_meta.py
18@@ -1264,7 +1264,7 @@ class TestDiskHandler(CiTestCase):
19 m_getpath.return_value = disk_path
20 block_meta.disk_handler(info, storage_config)
21 m_getpath.assert_called_with(info['id'], storage_config)
22- self.assertEqual(1, m_block.get_part_table_type.call_count)
23+ self.assertEqual(0, m_block.get_part_table_type.call_count)
24
25 @patch('curtin.commands.block_meta.block')
26 @patch('curtin.commands.block_meta.util')

Subscribers

People subscribed via source and target branches