Skip to content

Commit b0a6d8f

Browse files
authored
🐛 report correct status on user service fail (ITISFoundation#3610)
1 parent df595bb commit b0a6d8f

File tree

21 files changed

+524
-225
lines changed

21 files changed

+524
-225
lines changed

packages/models-library/src/models_library/generated_models/docker_rest_api.py

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: https://docs.docker.com/engine/api/v1.41.yaml
3-
# timestamp: 2022-11-19T13:23:51+00:00
3+
# timestamp: 2022-11-28T14:56:37+00:00
44

55
from __future__ import annotations
66

@@ -15,7 +15,7 @@ class Model(BaseModel):
1515
__root__: Any
1616

1717

18-
class Type(Enum):
18+
class Type(str, Enum):
1919
tcp = "tcp"
2020
udp = "udp"
2121
sctp = "sctp"
@@ -34,7 +34,7 @@ class Port(BaseModel):
3434
Type: Type
3535

3636

37-
class Type1(Enum):
37+
class Type1(str, Enum):
3838
"""
3939
The mount type:
4040
@@ -136,7 +136,7 @@ class ThrottleDevice(BaseModel):
136136
Rate: Optional[int] = Field(None, description="Rate", ge=0)
137137

138138

139-
class Propagation(Enum):
139+
class Propagation(str, Enum):
140140
"""
141141
A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.
142142
"""
@@ -232,7 +232,7 @@ class Mount(BaseModel):
232232
)
233233

234234

235-
class Name(Enum):
235+
class Name(str, Enum):
236236
"""
237237
- Empty string means not to restart
238238
- `no` Do not automatically restart
@@ -482,7 +482,7 @@ class HealthConfig(BaseModel):
482482
)
483483

484484

485-
class Status(Enum):
485+
class Status(str, Enum):
486486
"""
487487
Status is one of `none`, `starting`, `healthy` or `unhealthy`
488488
@@ -523,7 +523,7 @@ class HealthcheckResult(BaseModel):
523523
Output: Optional[str] = Field(None, description="Output from last check")
524524

525525

526-
class Type3(Enum):
526+
class Type3(str, Enum):
527527
json_file = "json-file"
528528
syslog = "syslog"
529529
journald = "journald"
@@ -544,7 +544,7 @@ class LogConfig(BaseModel):
544544
Config_: Optional[dict[str, str]] = Field(None, alias="Config")
545545

546546

547-
class CgroupnsMode(Enum):
547+
class CgroupnsMode(str, Enum):
548548
"""
549549
cgroup namespace mode for the container. Possible values are:
550550
@@ -564,7 +564,7 @@ class ConsoleSizeItem(BaseModel):
564564
__root__: int = Field(..., ge=0)
565565

566566

567-
class Isolation(Enum):
567+
class Isolation(str, Enum):
568568
"""
569569
Isolation technology of the container. (Windows only)
570570
@@ -963,7 +963,7 @@ class ProcessConfig(BaseModel):
963963
arguments: Optional[list[str]] = None
964964

965965

966-
class Scope(Enum):
966+
class Scope(str, Enum):
967967
"""
968968
The level at which the volume exists. Either `global` for cluster-wide,
969969
or `local` for machine level.
@@ -1080,7 +1080,7 @@ class NetworkContainer(BaseModel):
10801080
IPv6Address: Optional[str] = None
10811081

10821082

1083-
class Type4(Enum):
1083+
class Type4(str, Enum):
10841084
"""
10851085
Cache record type.
10861086
@@ -1242,7 +1242,7 @@ class Settings(BaseModel):
12421242
Devices: list[PluginDevice]
12431243

12441244

1245-
class ProtocolScheme(Enum):
1245+
class ProtocolScheme(str, Enum):
12461246
"""
12471247
Protocol to use for clients connecting to the plugin.
12481248
"""
@@ -1382,7 +1382,7 @@ class ObjectVersion(BaseModel):
13821382
Index: Optional[int] = Field(None, example=373531)
13831383

13841384

1385-
class Role(Enum):
1385+
class Role(str, Enum):
13861386
"""
13871387
Role of the node.
13881388
"""
@@ -1391,7 +1391,7 @@ class Role(Enum):
13911391
manager = "manager"
13921392

13931393

1394-
class Availability(Enum):
1394+
class Availability(str, Enum):
13951395
"""
13961396
Availability of the node.
13971397
"""
@@ -1491,7 +1491,7 @@ class TLSInfo(BaseModel):
14911491
)
14921492

14931493

1494-
class NodeState(Enum):
1494+
class NodeState(str, Enum):
14951495
"""
14961496
NodeState represents the state of a node.
14971497
"""
@@ -1502,7 +1502,7 @@ class NodeState(Enum):
15021502
disconnected = "disconnected"
15031503

15041504

1505-
class Reachability(Enum):
1505+
class Reachability(str, Enum):
15061506
"""
15071507
Reachability represents the reachability of a node.
15081508
"""
@@ -1565,7 +1565,7 @@ class Dispatcher(BaseModel):
15651565
)
15661566

15671567

1568-
class Protocol(Enum):
1568+
class Protocol(str, Enum):
15691569
"""
15701570
Protocol for communication with the external CA (currently
15711571
only `cfssl` is supported).
@@ -2044,7 +2044,7 @@ class NetworkAttachmentSpec(BaseModel):
20442044
)
20452045

20462046

2047-
class Condition(Enum):
2047+
class Condition(str, Enum):
20482048
"""
20492049
Condition for restart.
20502050
"""
@@ -2125,7 +2125,7 @@ class LogDriver1(BaseModel):
21252125
Options: Optional[dict[str, str]] = None
21262126

21272127

2128-
class TaskState(Enum):
2128+
class TaskState(str, Enum):
21292129
new = "new"
21302130
allocated = "allocated"
21312131
pending = "pending"
@@ -2194,7 +2194,7 @@ class Mode(BaseModel):
21942194
)
21952195

21962196

2197-
class FailureAction(Enum):
2197+
class FailureAction(str, Enum):
21982198
"""
21992199
Action to take if an updated task fails to run, or stops running
22002200
during the update.
@@ -2206,7 +2206,7 @@ class FailureAction(Enum):
22062206
rollback = "rollback"
22072207

22082208

2209-
class Order(Enum):
2209+
class Order(str, Enum):
22102210
"""
22112211
The order of operations when rolling out an updated task. Either
22122212
the old task is shut down before the new task is started, or the
@@ -2248,7 +2248,7 @@ class UpdateConfig(BaseModel):
22482248
)
22492249

22502250

2251-
class FailureAction1(Enum):
2251+
class FailureAction1(str, Enum):
22522252
"""
22532253
Action to take if an rolled back task fails to run, or stops
22542254
running during the rollback.
@@ -2290,7 +2290,7 @@ class RollbackConfig(BaseModel):
22902290
)
22912291

22922292

2293-
class PublishMode(Enum):
2293+
class PublishMode(str, Enum):
22942294
"""
22952295
The mode in which port is published.
22962296
@@ -2324,7 +2324,7 @@ class EndpointPortConfig(BaseModel):
23242324
)
23252325

23262326

2327-
class Mode1(Enum):
2327+
class Mode1(str, Enum):
23282328
"""
23292329
The mode of resolution to use for internal load balancing between tasks.
23302330
@@ -2360,7 +2360,7 @@ class Endpoint(BaseModel):
23602360
VirtualIPs: Optional[list[VirtualIP]] = None
23612361

23622362

2363-
class State(Enum):
2363+
class State(str, Enum):
23642364
updating = "updating"
23652365
paused = "paused"
23662366
completed = "completed"
@@ -2508,7 +2508,7 @@ class Config2(BaseModel):
25082508
Spec: Optional[ConfigSpec] = None
25092509

25102510

2511-
class Status2(Enum):
2511+
class Status2(str, Enum):
25122512
"""
25132513
String representation of the container state. Can be one of "created",
25142514
"running", "paused", "restarting", "removing", "exited", or "dead".
@@ -2607,7 +2607,7 @@ class SystemVersion(BaseModel):
26072607
)
26082608

26092609

2610-
class CgroupDriver(Enum):
2610+
class CgroupDriver(str, Enum):
26112611
"""
26122612
The driver to use for managing cgroups.
26132613
@@ -2618,7 +2618,7 @@ class CgroupDriver(Enum):
26182618
none = "none"
26192619

26202620

2621-
class CgroupVersion(Enum):
2621+
class CgroupVersion(str, Enum):
26222622
"""
26232623
The version of the cgroup.
26242624
@@ -2628,7 +2628,7 @@ class CgroupVersion(Enum):
26282628
field_2 = "2"
26292629

26302630

2631-
class Isolation2(Enum):
2631+
class Isolation2(str, Enum):
26322632
"""
26332633
Represents the isolation technology to use as a default for containers.
26342634
The supported values are platform-specific.
@@ -2770,7 +2770,7 @@ class Commit(BaseModel):
27702770
)
27712771

27722772

2773-
class LocalNodeState(Enum):
2773+
class LocalNodeState(str, Enum):
27742774
"""
27752775
Current local status of this node.
27762776
"""
@@ -2838,7 +2838,7 @@ class EventActor(BaseModel):
28382838
)
28392839

28402840

2841-
class Type5(Enum):
2841+
class Type5(str, Enum):
28422842
"""
28432843
The type of object emitting the event
28442844
"""
@@ -2856,7 +2856,7 @@ class Type5(Enum):
28562856
volume = "volume"
28572857

28582858

2859-
class Scope1(Enum):
2859+
class Scope1(str, Enum):
28602860
"""
28612861
Scope of the event. Engine events are `local` scope. Cluster (Swarm)
28622862
events are `swarm` scope.
@@ -4026,6 +4026,3 @@ class SystemInfo(BaseModel):
40264026
"WARNING: bridge-nf-call-ip6tables is disabled",
40274027
],
40284028
)
4029-
4030-
4031-
# nopycln: file

packages/models-library/src/models_library/projects_ui.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Models Front-end UI
33
"""
44

5-
from typing import Dict, Literal, Optional, TypedDict
5+
from typing import Literal, Optional, TypedDict
66

77
from pydantic import BaseModel, Extra, Field
88
from pydantic.color import Color
@@ -24,13 +24,13 @@ class _SlideshowRequired(TypedDict):
2424

2525

2626
class Slideshow(_SlideshowRequired, total=False):
27-
instructions: Optional[str] # "Instructions about what to do in this step"
27+
instructions: Optional[str] # "Instructions about what to do in this step"
2828

2929

3030
class Annotation(BaseModel):
3131
type: Literal["rect", "text"] = Field(...)
3232
color: Color = Field(...)
33-
attributes: Dict = Field(..., description="svg attributes")
33+
attributes: dict = Field(..., description="svg attributes")
3434

3535
class Config:
3636
extra = Extra.forbid
@@ -51,10 +51,10 @@ class Config:
5151

5252

5353
class StudyUI(BaseModel):
54-
workbench: Optional[Dict[NodeIDStr, WorkbenchUI]] = None
55-
slideshow: Optional[Dict[NodeIDStr, Slideshow]] = None
54+
workbench: Optional[dict[NodeIDStr, WorkbenchUI]] = None
55+
slideshow: Optional[dict[NodeIDStr, Slideshow]] = None
5656
current_node_id: Optional[NodeID] = Field(None, alias="currentNodeId")
57-
annotations: Optional[Dict[NodeIDStr, Annotation]] = None
57+
annotations: Optional[dict[NodeIDStr, Annotation]] = None
5858

5959
class Config:
6060
extra = Extra.allow

scripts/openapi-pydantic-models-generator.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -o nounset
66
set -o pipefail
77
IFS=$'\n\t'
88

9-
PYTHON_VERSION=3.9.12
9+
PYTHON_VERSION=3.9
1010
IMAGE_NAME="local/datamodel-code-generator:${PYTHON_VERSION}"
1111
WORKDIR="$(pwd)"
1212

@@ -29,6 +29,7 @@ ENTRYPOINT ["datamodel-codegen", \
2929
"--reuse-model", \
3030
"--set-default-enum-member", \
3131
"--use-title-as-name", \
32+
"--use-subclass-enum", \
3233
"--target-python-version=${PYTHON_VERSION}", \
3334
"--validation"]
3435
EOF

0 commit comments

Comments
 (0)