1 # Copyright 2021 Canonical Ltd.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
23 "automatically-retry-hooks",
26 "container-image-metadata-url",
27 "container-image-stream",
28 "container-inherit-properties",
29 "container-networking-method",
33 "disable-network-management",
35 "enable-os-refresh-update",
42 "ignore-machine-addresses",
52 "max-action-results-age",
53 "max-action-results-size",
54 "max-status-history-age",
55 "max-status-history-size",
56 "net-bond-reconfigure-delay",
58 "provisioner-harvest-mode",
62 "snap-store-assertions",
64 "snap-store-proxy-url",
65 "ssl-hostname-verification",
67 "transmit-vendor-metrics",
68 "update-status-hook-interval",
72 class ModelConfig(dict):
73 prefix
= "model_config_"
75 def __init__(self
, config
: dict):
76 for key
, value
in config
.items():
78 key
.startswith(self
.prefix
)
79 and self
._get
_renamed
_key
(key
) in MODEL_CONFIG_KEYS
81 self
.__setitem
__(self
._get
_renamed
_key
(key
), value
)
83 def _get_renamed_key(self
, key
):
84 return key
.replace(self
.prefix
, "").replace("_", "-")