Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions pkg/cli/admin/nodeimage/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,9 @@ func (o *CreateOptions) createConfigFileFromFlags() ([]byte, error) {
}
if o.SingleNodeOpts.RootDeviceHints != "" {
parts := strings.SplitN(o.SingleNodeOpts.RootDeviceHints, ":", 2)
if len(parts) != 2 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general we don't want to duplicate the node-joiner logic here, since the oc command must be as much as possible a simple wrapper. So, if there is an issue it must be fixed on the node-joiner side, and reuse the already existing workflow for reporting back the error to the user

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The format of the CLI arg is effectively already defined here (on the previous line) isn't it? And node-joiner uses a different format (proper yaml).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's perfectly right, I misread the original issue, this is an oc interface and not related to node-joiner

/approve

return nil, fmt.Errorf("incorrect rootDeviceHints format provided: %s. Expected format: <hint name>:<value>, for example: deviceName:/dev/sda", o.SingleNodeOpts.RootDeviceHints)
}
host["rootDeviceHints"] = map[string]interface{}{
parts[0]: parts[1],
}
Expand Down
7 changes: 7 additions & 0 deletions pkg/cli/admin/nodeimage/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,13 @@ func TestCreateConfigFileFromFlags(t *testing.T) {
},
expectedConfigFile: expectedConfigFile,
},
{
name: "root device hints incorrect",
singleNodeCreateOptions: &singleNodeCreateOptions{
RootDeviceHints: "/dev/sda",
},
expectedError: "incorrect rootDeviceHints format provided: /dev/sda. Expected format: <hint name>:<value>, for example: deviceName:/dev/sda",
},
{
name: "ssh-key-path missing or incorrect",
singleNodeCreateOptions: &singleNodeCreateOptions{
Expand Down