11from sebs .cache import Cache
2- from sebs .faas .config import Credentials , Resources , Config
2+ from sebs .faas .config import Resources , Config
33from sebs .utils import LoggingHandlers
44from sebs .storage .config import MinioConfig
55
@@ -53,9 +53,9 @@ def registry_updated(self) -> bool:
5353 @staticmethod
5454 def initialize (res : Resources , dct : dict ):
5555 ret = cast (KnativeResources , res )
56- ret ._docker_registry = dct [ "registry" ]
57- ret ._docker_username = dct [ "username" ]
58- ret ._docker_password = dct [ "password" ]
56+ ret ._docker_registry = dct . get ( "registry" )
57+ ret ._docker_username = dct . get ( "username" )
58+ ret ._docker_password = dct . get ( "password" )
5959
6060 @staticmethod
6161 def deserialize (config : dict , cache : Cache , handlers : LoggingHandlers ) -> Resources :
@@ -101,7 +101,9 @@ def deserialize(config: dict, cache: Cache, handlers: LoggingHandlers) -> Resour
101101 # Check for new config
102102 if "storage" in config :
103103 ret ._storage = MinioConfig .deserialize (config ["storage" ])
104- ret .logging .info ("Using user-provided configuration of storage for Knative." )
104+ ret .logging .info (
105+ "Using user-provided configuration of storage for Knative."
106+ )
105107
106108 # check if there has been an update
107109 if not (
@@ -122,21 +124,26 @@ def deserialize(config: dict, cache: Cache, handlers: LoggingHandlers) -> Resour
122124 and "resources" in cached_config
123125 and "storage" in cached_config ["resources" ]
124126 ):
125- ret ._storage = MinioConfig .deserialize (cached_config ["resources" ]["storage" ])
127+ ret ._storage = MinioConfig .deserialize (
128+ cached_config ["resources" ]["storage" ]
129+ )
126130 ret .logging .info ("Using cached configuration of storage for Knative." )
127131
128132 return ret
129133
130134 def update_cache (self , cache : Cache ):
131135 super ().update_cache (cache )
132136 cache .update_config (
133- val = self .docker_registry , keys = ["knative" , "resources" , "docker" , "registry" ]
137+ val = self .docker_registry ,
138+ keys = ["knative" , "resources" , "docker" , "registry" ],
134139 )
135140 cache .update_config (
136- val = self .docker_username , keys = ["knative" , "resources" , "docker" , "username" ]
141+ val = self .docker_username ,
142+ keys = ["knative" , "resources" , "docker" , "username" ],
137143 )
138144 cache .update_config (
139- val = self .docker_password , keys = ["knative" , "resources" , "docker" , "password" ]
145+ val = self .docker_password ,
146+ keys = ["knative" , "resources" , "docker" , "password" ],
140147 )
141148 if self ._storage :
142149 self ._storage .update_cache (["knative" , "resources" , "storage" ], cache )
@@ -186,7 +193,7 @@ def deserialize(config: dict, cache: Cache, handlers: LoggingHandlers) -> Config
186193 KnativeResources , KnativeResources .deserialize (config , cache , handlers )
187194 )
188195
189- res = KnativeConfig (config , cached_config )
196+ res = KnativeConfig (config , cache )
190197 res .logging_handlers = handlers
191198 res ._resources = resources
192199 return res
0 commit comments