Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default metadata endpoint handling #49

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Change default handling of /metadata endpoint
This is so we can avoid confusion when taking into account the handling
of /meta-data. In EM Production today (Kant) /meta-data and /metadata
both have the same output data. Making Hegel match by default is in line
with the goal of Hegel as a Kant replacement.

This is a bc-break and there's no current way to fetch the full
hardware.metadata json field, but I'm ok with that. This should all go
away when the Instance Proposal is implemented.

Signed-off-by: Manuel Mendez <[email protected]>
mmlb committed Nov 6, 2020
commit 4970c17d327b164f336741fd4fb906d6e18666b9
18 changes: 9 additions & 9 deletions http_server_test.go
Original file line number Diff line number Diff line change
@@ -144,9 +144,9 @@ func TestGetMetadataTinkerbell(t *testing.T) {
t.Error("Error in unmarshalling hardware metadata:", err)
}

if int64(metadata["bonding_mode"].(float64)) != test.bondingMode {
t.Errorf("handler returned unexpected bonding mode: got %v want %v",
metadata["bonding_mode"], test.bondingMode)
if metadata["crypted_root_password"].(string) != test.crypted_root_password {
t.Errorf("handler returned unexpected crypted_root_password: got %v want %v",
metadata["crypted_root_password"], test.crypted_root_password)
}
})
}
@@ -469,14 +469,14 @@ var cacherTests = map[string]struct {

// test cases for TestGetMetadataTinkerbell
var tinkerbellTests = map[string]struct {
id string
bondingMode int64
json string
id string
crypted_root_password string
json string
}{
"tinkerbell": {
id: "fde7c87c-d154-447e-9fce-7eb7bdec90c0",
bondingMode: 5,
json: tinkerbellDataModel,
id: "fde7c87c-d154-447e-9fce-7eb7bdec90c0",
crypted_root_password: "redacted/",
json: tinkerbellDataModel,
},
"tinkerbell no metadata": {
id: "363115b0-f03d-4ce5-9a15-5514193d131a",
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ func (hg hardwareGetterTinkerbell) Watch(ctx context.Context, in getRequest, opt
return w, nil
}

const defaultCustomEndpoints = `{"/metadata":".metadata"}`
const defaultCustomEndpoints = `{"/metadata":".metadata.instance"}`

var (
facility = flag.String("facility", env.Get("HEGEL_FACILITY", "onprem"),