17
17
18
18
All errors inherit from craft_cli.CraftError.
19
19
"""
20
+
20
21
from __future__ import annotations
21
22
22
23
import os
@@ -275,7 +276,6 @@ class UbuntuProClientNotFoundError(UbuntuProApiError):
275
276
"""Raised when Ubuntu Pro client was not found on the system."""
276
277
277
278
def __init__ (self , path : str ) -> None :
278
-
279
279
message = f'The Ubuntu Pro client was not found on the system at "{ path } "'
280
280
281
281
super ().__init__ (message = message )
@@ -285,7 +285,6 @@ class UbuntuProDetachedError(InvalidUbuntuProStateError):
285
285
"""Raised when Ubuntu Pro is not attached, but Pro services were requested."""
286
286
287
287
def __init__ (self ) -> None :
288
-
289
288
message = "Ubuntu Pro is requested, but was found detached."
290
289
resolution = 'Attach Ubuntu Pro to continue. See "pro" command for details.'
291
290
@@ -296,7 +295,6 @@ class UbuntuProAttachedError(InvalidUbuntuProStateError):
296
295
"""Raised when Ubuntu Pro is attached, but Pro services were not requested."""
297
296
298
297
def __init__ (self ) -> None :
299
-
300
298
message = "Ubuntu Pro is not requested, but was found attached."
301
299
resolution = 'Detach Ubuntu Pro to continue. See "pro" command for details.'
302
300
@@ -310,7 +308,6 @@ class InvalidUbuntuProServiceError(InvalidUbuntuProStateError):
310
308
# if so where is the list of supported service names?
311
309
312
310
def __init__ (self , invalid_services : set [str ]) -> None :
313
-
314
311
invalid_services_str = "" .join (invalid_services )
315
312
316
313
message = "Invalid Ubuntu Pro Services were requested."
@@ -325,20 +322,15 @@ def __init__(self, invalid_services: set[str]) -> None:
325
322
326
323
327
324
class InvalidUbuntuProStatusError (InvalidUbuntuProStateError ):
328
- """Raised when the incorrect set of Pro Services are enabled."""
329
-
330
- def __init__ (
331
- self , requested_services : set [str ], available_services : set [str ]
332
- ) -> None :
325
+ """Raised when a set of requested Pro Services are disabled."""
333
326
334
- enable_services_str = " " . join ( requested_services - available_services )
335
- disable_services_str = " " .join (available_services - requested_services )
327
+ def __init__ ( self , requested_services : set [ str ]) -> None :
328
+ requested_services_str = ", " .join (requested_services )
336
329
337
- message = "Incorrect Ubuntu Pro Services were enabled ."
330
+ message = "Some of the requested Ubuntu Pro Services are disabled ."
338
331
resolution = (
339
- "Please enable or disable the following services.\n "
340
- f"Enable: { enable_services_str } \n "
341
- f"Disable: { disable_services_str } \n "
332
+ "Please enable the following services.\n "
333
+ f"Enable: { requested_services_str } \n "
342
334
'See "pro" command for details.'
343
335
)
344
336
0 commit comments