endpoints: add body logging
Add body logging for POST methods that accept a Payload for data. Use repr=False on UbuntuAdvantageForm to not log the token.
This commit is contained in:
parent
07b8b50399
commit
824f6bbaee
|
@ -391,7 +391,7 @@ class TimeZoneInfo:
|
|||
|
||||
@attr.s(auto_attribs=True)
|
||||
class UbuntuAdvantageInfo:
|
||||
token: str
|
||||
token: str = attr.ib(repr=False)
|
||||
|
||||
|
||||
class ShutdownMode(enum.Enum):
|
||||
|
|
|
@ -232,6 +232,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
dasd=self.model._probe_data.get('dasd', {}))
|
||||
|
||||
async def POST(self, config: list):
|
||||
log.debug(config)
|
||||
self.model._actions = self.model._actions_from_config(
|
||||
config, self.model._probe_data['blockdev'], is_probe_data=False)
|
||||
await self.configured()
|
||||
|
@ -268,6 +269,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
disks=[labels.for_client(d, min_size=min_size) for d in disks])
|
||||
|
||||
async def guided_POST(self, data: GuidedChoice) -> StorageResponse:
|
||||
log.debug(data)
|
||||
self.guided(data)
|
||||
return await self.GET()
|
||||
|
||||
|
@ -322,6 +324,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
return await self.v2_GET()
|
||||
|
||||
async def v2_guided_POST(self, data: GuidedChoice) -> StorageResponseV2:
|
||||
log.debug(data)
|
||||
self.guided(data)
|
||||
return await self.v2_GET()
|
||||
|
||||
|
@ -341,6 +344,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
|
||||
async def v2_add_partition_POST(self, data: ModifyPartitionV2) \
|
||||
-> StorageResponseV2:
|
||||
log.debug(data)
|
||||
if data.partition.format is None:
|
||||
raise ValueError('add_partition must supply format')
|
||||
if data.partition.boot is not None:
|
||||
|
@ -361,6 +365,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
|
||||
async def v2_delete_partition_POST(self, data: ModifyPartitionV2) \
|
||||
-> StorageResponseV2:
|
||||
log.debug(data)
|
||||
disk = self.model._one(id=data.disk_id)
|
||||
partition = self.get_partition(disk, data.partition.number)
|
||||
self.delete_partition(partition)
|
||||
|
@ -368,6 +373,7 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
|
||||
async def v2_edit_partition_POST(self, data: ModifyPartitionV2) \
|
||||
-> StorageResponseV2:
|
||||
log.debug(data)
|
||||
disk = self.model._one(id=data.disk_id)
|
||||
partition = self.get_partition(disk, data.partition.number)
|
||||
if data.partition.size not in (None, partition.size):
|
||||
|
|
|
@ -216,6 +216,7 @@ class KeyboardController(SubiquityController):
|
|||
layouts=self.keyboard_list.layouts)
|
||||
|
||||
async def POST(self, data: KeyboardSetting):
|
||||
log.debug(data)
|
||||
new = latinizable(data.layout, data.variant)
|
||||
if new is not None:
|
||||
data = KeyboardSetting(new[0], new[1], data.toggle)
|
||||
|
|
|
@ -148,6 +148,7 @@ class MirrorController(SubiquityController):
|
|||
return self.model.get_mirror()
|
||||
|
||||
async def POST(self, data: str):
|
||||
log.debug(data)
|
||||
self.model.set_mirror(data)
|
||||
await self.configured()
|
||||
|
||||
|
@ -155,4 +156,5 @@ class MirrorController(SubiquityController):
|
|||
return self.model.config.get('disable_components', [])
|
||||
|
||||
async def disable_components_POST(self, data: List[str]):
|
||||
log.debug(data)
|
||||
self.model.config['disable_components'] = data
|
||||
|
|
|
@ -184,6 +184,7 @@ class SnapListController(SubiquityController):
|
|||
selections=self.model.selections)
|
||||
|
||||
async def POST(self, data: List[SnapSelection]):
|
||||
log.debug(data)
|
||||
self.model.set_installed_list(data)
|
||||
await self.configured()
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ class UbuntuAdvantageController(SubiquityController):
|
|||
""" Handle a POST request coming from the client-side controller and
|
||||
then call .configured().
|
||||
"""
|
||||
log.debug("Received POST: %s", data)
|
||||
self.model.token = data.token
|
||||
await self.configured()
|
||||
|
||||
|
|
Loading…
Reference in New Issue