forked from warewulf/warewulf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Remove kernel imports and kmods images - Repurpose KernelOverride as container path - Support Kernel.Version as version prefix for kernel selection - Compare initramfs by version Signed-off-by: Jonathon Anderson <[email protected]>
- Loading branch information
1 parent
d87ed27
commit 8f21d54
Showing
40 changed files
with
965 additions
and
972 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package completions | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/warewulf/warewulf/internal/pkg/hostlist" | ||
"github.com/warewulf/warewulf/internal/pkg/kernel" | ||
"github.com/warewulf/warewulf/internal/pkg/node" | ||
) | ||
|
||
func NodeKernelOverride(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { | ||
var kernelPaths []string | ||
registry, err := node.New() | ||
if err != nil { | ||
return kernelPaths, cobra.ShellCompDirectiveNoFileComp | ||
} | ||
nodes := hostlist.Expand(args) | ||
for _, id := range nodes { | ||
if node_, err := registry.GetNode(id); err != nil { | ||
continue | ||
} else if node_.ContainerName != "" { | ||
kernels := kernel.FindKernels(node_.ContainerName) | ||
for _, kernel_ := range kernels { | ||
kernelPaths = append(kernelPaths, kernel_.Path) | ||
} | ||
} | ||
} | ||
return kernelPaths, cobra.ShellCompDirectiveNoFileComp | ||
} | ||
|
||
func NodeKernelVersion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { | ||
var kernelVersions []string | ||
registry, err := node.New() | ||
if err != nil { | ||
return kernelVersions, cobra.ShellCompDirectiveNoFileComp | ||
} | ||
nodes := hostlist.Expand(args) | ||
for _, id := range nodes { | ||
if node_, err := registry.GetNode(id); err != nil { | ||
continue | ||
} else if node_.ContainerName != "" { | ||
kernels := kernel.FindKernels(node_.ContainerName) | ||
for _, kernel_ := range kernels { | ||
kernelVersions = append(kernelVersions, kernel_.Version()) | ||
} | ||
} | ||
} | ||
return kernelVersions, cobra.ShellCompDirectiveNoFileComp | ||
} | ||
|
||
func ProfileKernelOverride(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { | ||
var kernelPaths []string | ||
registry, err := node.New() | ||
if err != nil { | ||
return kernelPaths, cobra.ShellCompDirectiveNoFileComp | ||
} | ||
for _, id := range args { | ||
if profile, err := registry.GetProfile(id); err != nil { | ||
continue | ||
} else if profile.ContainerName != "" { | ||
kernels := kernel.FindKernels(profile.ContainerName) | ||
for _, kernel_ := range kernels { | ||
kernelPaths = append(kernelPaths, kernel_.Path) | ||
} | ||
} | ||
} | ||
return kernelPaths, cobra.ShellCompDirectiveNoFileComp | ||
} | ||
|
||
func ProfileKernelVersion(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { | ||
var kernelVersions []string | ||
registry, err := node.New() | ||
if err != nil { | ||
return kernelVersions, cobra.ShellCompDirectiveNoFileComp | ||
} | ||
for _, id := range args { | ||
if profile, err := registry.GetProfile(id); err != nil { | ||
continue | ||
} else if profile.ContainerName != "" { | ||
kernels := kernel.FindKernels(profile.ContainerName) | ||
for _, kernel_ := range kernels { | ||
kernelVersions = append(kernelVersions, kernel_.Version()) | ||
} | ||
} | ||
} | ||
return kernelVersions, cobra.ShellCompDirectiveNoFileComp | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.