mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-08 17:25:14 -04:00
constellation-lib: refactor init RPC to be shared (#2665)
* constellation-lib: refactor init RPC Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * constellation-lib: pass io.Writer for collecting logs Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * constellation-lib: add init test Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * constellation-lib: bin dialer to struct Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * constellation-lib: set service CIDR on init Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> --------- Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com>
This commit is contained in:
parent
db49093da7
commit
17aecaaf5f
12 changed files with 758 additions and 342 deletions
|
@ -23,7 +23,7 @@ import (
|
|||
|
||||
// NewValidator creates a new Validator.
|
||||
func NewValidator(cmd *cobra.Command, config config.AttestationCfg, log debugLog) (atls.Validator, error) {
|
||||
return choose.Validator(config, warnLogger{cmd: cmd, log: log})
|
||||
return choose.Validator(config, WarnLogger{Cmd: cmd, Log: log})
|
||||
}
|
||||
|
||||
// UpdateInitMeasurements sets the owner and cluster measurement values.
|
||||
|
@ -102,21 +102,21 @@ func decodeMeasurement(encoded string) ([]byte, error) {
|
|||
return decoded, nil
|
||||
}
|
||||
|
||||
// warnLogger implements logging of warnings for validators.
|
||||
type warnLogger struct {
|
||||
cmd *cobra.Command
|
||||
log debugLog
|
||||
// WarnLogger implements logging of warnings for validators.
|
||||
type WarnLogger struct {
|
||||
Cmd *cobra.Command
|
||||
Log debugLog
|
||||
}
|
||||
|
||||
// Infof messages are reduced to debug messages, since we don't want
|
||||
// the extra info when using the CLI without setting the debug flag.
|
||||
func (wl warnLogger) Infof(fmtStr string, args ...any) {
|
||||
wl.log.Debugf(fmtStr, args...)
|
||||
func (wl WarnLogger) Infof(fmtStr string, args ...any) {
|
||||
wl.Log.Debugf(fmtStr, args...)
|
||||
}
|
||||
|
||||
// Warnf prints a formatted warning from the validator.
|
||||
func (wl warnLogger) Warnf(fmtStr string, args ...any) {
|
||||
wl.cmd.PrintErrf("Warning: %s\n", fmt.Sprintf(fmtStr, args...))
|
||||
func (wl WarnLogger) Warnf(fmtStr string, args ...any) {
|
||||
wl.Cmd.PrintErrf("Warning: %s\n", fmt.Sprintf(fmtStr, args...))
|
||||
}
|
||||
|
||||
type debugLog interface {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue