Commit b45eaa0b authored by Lisa Velden's avatar Lisa Velden

Fail if secret parameters are missing

Raise an OpPrereqError if secret parameters are expected, but missing.
Job retries result in this error.
Signed-off-by: default avatarLisa Velden <velden@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent 5b36e6e4
......@@ -276,6 +276,17 @@ def _LockList(names):
return list(names)
def _CheckSecretParameters(op):
"""Check if secret parameters are expected, but missing.
"""
if hasattr(op, "osparams_secret") and op.osparams_secret:
for secret_param in op.osparams_secret:
if op.osparams_secret[secret_param].Get() == constants.REDACTED:
raise errors.OpPrereqError("Please re-submit secret parameters to job.",
errors.ECODE_INVAL)
class Processor(object):
"""Object which runs OpCodes"""
DISPATCH_TABLE = _ComputeDispatchTable()
......@@ -687,6 +698,7 @@ class Processor(object):
lu = lu_class(self, op, self.cfg, self.rpc,
self._wconfdcontext, self.wconfd)
lu.wconfdlocks = self.wconfd.Client().ListLocks(self._wconfdcontext)
_CheckSecretParameters(op)
lu.ExpandNames()
assert lu.needed_locks is not None, "needed_locks not set by LU"
......
......@@ -5262,6 +5262,10 @@ debugModeConfidentialityWarning =
"ALERT: %s started in debug mode.\n\
\ Private and secret parameters WILL be logged!\n"
-- | Use to hide secret parameter value
redacted :: String
redacted = Types.redacted
-- * Stat dictionary entries
--
-- The get_file_info RPC returns a number of values as a dictionary, and the
......
......@@ -177,6 +177,7 @@ module Ganeti.Types
, Secret(..)
, showSecretJSObject
, revealValInJSObject
, redacted
, HvParams
, OsParams
, OsParamsPrivate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment