This is mostly intended for automation that wants to check
for these certificates and handle the results themselves.
Without this flag an exception will be logged which isn't
great for automation tools that may check for this repeatedly
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit
c187b0d6e22e7b6b42e11572be358b31759d9f6b)
self,
entity: str,
service_name: Optional[str] = None,
- hostname: Optional[str] = None
+ hostname: Optional[str] = None,
+ no_exception_when_missing: bool = False
) -> str:
cert = self.cert_key_store.get_cert(entity, service_name or '', hostname or '')
if not cert:
+ if no_exception_when_missing:
+ return ''
raise OrchSecretNotFound(entity=entity, service_name=service_name, hostname=hostname)
return cert
self,
entity: str,
service_name: Optional[str] = None,
- hostname: Optional[str] = None
+ hostname: Optional[str] = None,
+ no_exception_when_missing: bool = False
) -> str:
key = self.cert_key_store.get_key(entity, service_name or '', hostname or '')
if not key:
+ if no_exception_when_missing:
+ return ''
raise OrchSecretNotFound(entity=entity, service_name=service_name, hostname=hostname)
return key
self,
entity: str,
service_name: Optional[str] = None,
- hostname: Optional[str] = None
+ hostname: Optional[str] = None,
+ no_exception_when_missing: bool = False
) -> OrchResult[str]:
raise NotImplementedError()
self,
entity: str,
service_name: Optional[str] = None,
- hostname: Optional[str] = None
+ hostname: Optional[str] = None,
+ no_exception_when_missing: bool = False
) -> OrchResult[str]:
raise NotImplementedError()
entity: str,
_end_positional_: int = 0,
service_name: Optional[str] = None,
- hostname: Optional[str] = None
+ hostname: Optional[str] = None,
+ no_exception_when_missing: bool = False
) -> HandleCommandResult:
- completion = self.cert_store_get_cert(entity, service_name, hostname)
+ completion = self.cert_store_get_cert(
+ entity,
+ service_name,
+ hostname,
+ no_exception_when_missing
+ )
cert = raise_if_exception(completion)
return HandleCommandResult(stdout=cert)
entity: str,
_end_positional_: int = 0,
service_name: Optional[str] = None,
- hostname: Optional[str] = None
+ hostname: Optional[str] = None,
+ no_exception_when_missing: bool = False
) -> HandleCommandResult:
- completion = self.cert_store_get_key(entity, service_name, hostname)
+ completion = self.cert_store_get_key(
+ entity,
+ service_name,
+ hostname,
+ no_exception_when_missing
+ )
key = raise_if_exception(completion)
return HandleCommandResult(stdout=key)