Skip to content

Commit

Permalink
Merge pull request #49 from cobbler/fix/login-requests
Browse files Browse the repository at this point in the history
Move client generation to CLI methods
  • Loading branch information
SchoolGuy authored Jun 16, 2024
2 parents 6b6c7cb + 304b62a commit 6ba1770
Show file tree
Hide file tree
Showing 24 changed files with 162 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/aclsetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var aclsetupCmd = &cobra.Command{
Long: "Configures users/groups to run the Cobbler CLI as non-root.",
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()
// TODO: call cobblerclient
},
}
Expand Down
1 change: 1 addition & 0 deletions cmd/buildiso.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var buildisoCmd = &cobra.Command{
Short: "Build an ISO",
Long: "Build all profiles into a bootable CD image. All flags are optional.",
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()
// TODO: call cobblerclient
},
}
Expand Down
9 changes: 8 additions & 1 deletion cmd/distro.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var distroAddCmd = &cobra.Command{
Short: "add distribution",
Long: `Adds a distribution.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

var newDistro cobbler.Distro
// internal fields (ctime, mtime, depth, uid, source-repos, tree-build-time) cannot be modified
Expand Down Expand Up @@ -69,6 +70,7 @@ var distroCopyCmd = &cobra.Command{
Short: "copy distribution",
Long: `Copies a distribution.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()
// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -79,6 +81,7 @@ var distroEditCmd = &cobra.Command{
Short: "edit distribution",
Long: `Edits a distribution.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// find distro through its name
dname, _ := cmd.Flags().GetString("name")
Expand Down Expand Up @@ -172,7 +175,7 @@ var distroFindCmd = &cobra.Command{
Short: "find distribution",
Long: `Finds a given distribution.`,
Run: func(cmd *cobra.Command, args []string) {

generateCobblerClient()
/*
dname, _ := cmd.Flags().GetString("name")
distro, err = Client.GetDistro(dname)
Expand All @@ -193,6 +196,7 @@ var distroListCmd = &cobra.Command{
Short: "list all distributions",
Long: `Lists all available distributions.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

distros, err = Client.GetDistros()

Expand All @@ -210,6 +214,7 @@ var distroRemoveCmd = &cobra.Command{
Short: "remove distribution",
Long: `Removes a given distribution.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

dname, _ := cmd.Flags().GetString("name")
err := Client.DeleteDistro(dname)
Expand All @@ -225,6 +230,7 @@ var distroRenameCmd = &cobra.Command{
Short: "rename distribution",
Long: `Renames a given distribution.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()
// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -235,6 +241,7 @@ var distroReportCmd = &cobra.Command{
Short: "list all distributions in detail",
Long: `Shows detailed information about all distributions.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()
// TODO: call cobblerclient
notImplemented()
},
Expand Down
16 changes: 16 additions & 0 deletions cmd/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var fileAddCmd = &cobra.Command{
Short: "add file",
Long: `Adds a file.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -34,6 +36,8 @@ var fileCopyCmd = &cobra.Command{
Short: "copy file",
Long: `Copies a file.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -44,6 +48,8 @@ var fileEditCmd = &cobra.Command{
Short: "edit file",
Long: `Edits a file.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -54,6 +60,8 @@ var fileFindCmd = &cobra.Command{
Short: "find file",
Long: `Finds a given file.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -64,6 +72,8 @@ var fileListCmd = &cobra.Command{
Short: "list all files",
Long: `Lists all available files.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -74,6 +84,8 @@ var fileRemoveCmd = &cobra.Command{
Short: "remove file",
Long: `Removes a given file.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -84,6 +96,8 @@ var fileRenameCmd = &cobra.Command{
Short: "rename file",
Long: `Renames a given file.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -94,6 +108,8 @@ var fileReportCmd = &cobra.Command{
Short: "list all files in detail",
Long: `Shows detailed information about all files.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand Down
1 change: 1 addition & 0 deletions cmd/hardlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ var hardlinkCmd = &cobra.Command{
Short: "Hardlink files",
Long: "Hardlink all files where it is possible to improve performance.",
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()
// TODO: call cobblerclient
},
}
Expand Down
16 changes: 16 additions & 0 deletions cmd/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var imageAddCmd = &cobra.Command{
Short: "add image",
Long: `Adds a image.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -34,6 +36,8 @@ var imageCopyCmd = &cobra.Command{
Short: "copy image",
Long: `Copies a image.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -44,6 +48,8 @@ var imageEditCmd = &cobra.Command{
Short: "edit image",
Long: `Edits a image.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -54,6 +60,8 @@ var imageFindCmd = &cobra.Command{
Short: "find image",
Long: `Finds a given image.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -64,6 +72,8 @@ var imageListCmd = &cobra.Command{
Short: "list all images",
Long: `Lists all available images.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -74,6 +84,8 @@ var imageRemoveCmd = &cobra.Command{
Short: "remove image",
Long: `Removes a given image.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -84,6 +96,8 @@ var imageRenameCmd = &cobra.Command{
Short: "rename image",
Long: `Renames a given image.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -94,6 +108,8 @@ var imageimagertCmd = &cobra.Command{
Short: "list all images in detail",
Long: `Shows detailed information about all images.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand Down
1 change: 1 addition & 0 deletions cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var importCmd = &cobra.Command{
See https://cobbler.readthedocs.io/en/latest/quickstart-guide.html#importing-your-first-distribution for more information.`,

Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()
// TODO: call cobblerclient
},
}
Expand Down
1 change: 1 addition & 0 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ most of the other Cobbler commands (currently: distro, profile, system, repo, im
Identical to 'cobbler report'`,

Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()
// TODO: call cobblerclient
},
}
Expand Down
16 changes: 16 additions & 0 deletions cmd/menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var menuAddCmd = &cobra.Command{
Short: "add menu",
Long: `Adds a menu.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -34,6 +36,8 @@ var menuCopyCmd = &cobra.Command{
Short: "copy menu",
Long: `Copies a menu.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -44,6 +48,8 @@ var menuEditCmd = &cobra.Command{
Short: "edit menu",
Long: `Edits a menu.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -54,6 +60,8 @@ var menuFindCmd = &cobra.Command{
Short: "find menu",
Long: `Finds a given menu.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -64,6 +72,8 @@ var menuListCmd = &cobra.Command{
Short: "list all menus",
Long: `Lists all available menus.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -74,6 +84,8 @@ var menuRemoveCmd = &cobra.Command{
Short: "remove menu",
Long: `Removes a given menu.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -84,6 +96,8 @@ var menuRenameCmd = &cobra.Command{
Short: "rename menu",
Long: `Renames a given menu.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -94,6 +108,8 @@ var menuReportCmd = &cobra.Command{
Short: "list all menus in detail",
Long: `Shows detailed information about all menus.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand Down
16 changes: 16 additions & 0 deletions cmd/mgmtclass.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ var mgmtclassAddCmd = &cobra.Command{
Short: "add mgmtclass",
Long: `Adds a mgmtclass.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -34,6 +36,8 @@ var mgmtclassCopyCmd = &cobra.Command{
Short: "copy mgmtclass",
Long: `Copies a mgmtclass.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -44,6 +48,8 @@ var mgmtclassEditCmd = &cobra.Command{
Short: "edit mgmtclass",
Long: `Edits a mgmtclass.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -54,6 +60,8 @@ var mgmtclassFindCmd = &cobra.Command{
Short: "find mgmtclass",
Long: `Finds a given mgmtclass.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -64,6 +72,8 @@ var mgmtclassListCmd = &cobra.Command{
Short: "list all mgmtclasses",
Long: `Lists all available mgmtclasses.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -74,6 +84,8 @@ var mgmtclassRemoveCmd = &cobra.Command{
Short: "remove mgmtclass",
Long: `Removes a given mgmtclass.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -84,6 +96,8 @@ var mgmtclassRenameCmd = &cobra.Command{
Short: "rename mgmtclass",
Long: `Renames a given mgmtclass.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand All @@ -94,6 +108,8 @@ var mgmtclassReportCmd = &cobra.Command{
Short: "list all mgmtclasses in detail",
Long: `Shows detailed information about all mgmtclasses.`,
Run: func(cmd *cobra.Command, args []string) {
generateCobblerClient()

// TODO: call cobblerclient
notImplemented()
},
Expand Down
Loading

0 comments on commit 6ba1770

Please sign in to comment.