Skip to content

Commit

Permalink
Merge pull request #50 from cobbler/feature/update-client-to-0-5-0
Browse files Browse the repository at this point in the history
Update client to 0.5.0
  • Loading branch information
SchoolGuy authored Sep 25, 2024
2 parents 6ba1770 + 17f6aea commit 4cb417e
Show file tree
Hide file tree
Showing 32 changed files with 5,708 additions and 2,151 deletions.
35 changes: 10 additions & 25 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
lint_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: pip install -U rstcheck doc8
run: pip install -U rstcheck doc8 sphinx
- name: Run rstcheck
run: rstcheck -r docs
- name: Run doc8
Expand All @@ -27,27 +27,12 @@ jobs:
name: Linting Go
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
# https://github.com/golangci/golangci-lint-action
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.29

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
args: -D errcheck

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true then the action will use pre-installed Go.
# skip-go-installation: true

# Optional: if set to true then the action don't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
# skip-build-cache: true
version: v1.61
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build:

clean:
go clean
rm ${BINARY_NAME}
rm -f ${BINARY_NAME}
rm -rf config/completions/*

cleandoc: ## Cleans the docs directory.
Expand Down
33 changes: 31 additions & 2 deletions cmd/aclsetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
package cmd

import (
"fmt"
"github.com/cobbler/cobblerclient"
"github.com/spf13/cobra"
)

Expand All @@ -14,9 +16,36 @@ var aclsetupCmd = &cobra.Command{
Short: "Adjust the access control list",
Long: "Configures users/groups to run the Cobbler CLI as non-root.",
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
RunE: func(cmd *cobra.Command, args []string) error {
generateCobblerClient()
// TODO: call cobblerclient
addUserOption, err := cmd.Flags().GetString("adduser")
if err != nil {
return err
}
addGroupOption, err := cmd.Flags().GetString("addgroup")
if err != nil {
return err
}
removeUserOption, err := cmd.Flags().GetString("removeuser")
if err != nil {
return err
}
removeGroupOption, err := cmd.Flags().GetString("removegroup")
if err != nil {
return err
}
aclSetupOptions := cobblerclient.AclSetupOptions{
AddUser: addUserOption,
AddGroup: addGroupOption,
RemoveUser: removeUserOption,
RemoveGroup: removeGroupOption,
}
eventId, err := Client.BackgroundAclSetup(aclSetupOptions)
if err != nil {
return err
}
fmt.Println("Event ID: ", eventId)
return nil
},
}

Expand Down
69 changes: 64 additions & 5 deletions cmd/buildiso.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
package cmd

import (
"fmt"
"github.com/cobbler/cobblerclient"
"github.com/spf13/cobra"
)

Expand All @@ -13,9 +15,66 @@ var buildisoCmd = &cobra.Command{
Use: "buildiso",
Short: "Build an ISO",
Long: "Build all profiles into a bootable CD image. All flags are optional.",
Run: func(cmd *cobra.Command, args []string) {
RunE: func(cmd *cobra.Command, args []string) error {
generateCobblerClient()
// TODO: call cobblerclient
isoOption, err := cmd.Flags().GetString("iso")
if err != nil {
return err
}
distroOption, err := cmd.Flags().GetString("distro")
if err != nil {
return err
}
xorrisofsOption, err := cmd.Flags().GetString("mkisofs-opts")
if err != nil {
return err
}
profilesOption, err := cmd.Flags().GetStringSlice("profiles")
if err != nil {
return err
}
sourceOption, err := cmd.Flags().GetString("source")
if err != nil {
return err
}
systemsOption, err := cmd.Flags().GetStringSlice("systems")
if err != nil {
return err
}
tempdirOption, err := cmd.Flags().GetString("tempdir")
if err != nil {
return err
}
standaloneOption, err := cmd.Flags().GetBool("standalone")
if err != nil {
return err
}
excludeDnsOption, err := cmd.Flags().GetBool("exclude-dns")
if err != nil {
return err
}
airgappedOption, err := cmd.Flags().GetBool("airgapped")
if err != nil {
return err
}
buildisoOptions := cobblerclient.BuildisoOptions{
Iso: isoOption,
Profiles: profilesOption,
Systems: systemsOption,
BuildisoDir: tempdirOption,
Distro: distroOption,
Standalone: standaloneOption,
Airgapped: airgappedOption,
Source: sourceOption,
ExcludeDns: excludeDnsOption,
XorrisofsOpts: xorrisofsOption,
}
eventId, err := Client.BackgroundBuildiso(buildisoOptions)
if err != nil {
return err
}
fmt.Printf("Event ID: %s\n", eventId)
return nil
},
}

Expand All @@ -28,9 +87,9 @@ func init() {
buildisoCmd.Flags().Bool("exclude-dns", false, "prevents addition of name server addresses to the kernel boot options")
buildisoCmd.Flags().String("iso", "", "output ISO to this file")
buildisoCmd.Flags().String("mkisofs-opts", "", "extra options for mkisofs")
buildisoCmd.Flags().String("profiles", "", "use these profiles only")
buildisoCmd.Flags().StringSlice("profiles", []string{}, "use these profiles only")
buildisoCmd.Flags().String("source", "", "used with --standalone to specify a source for the distribution files")
buildisoCmd.Flags().String("standalone", "", "creates a standalone ISO with all required distro files, but without any added repos")
buildisoCmd.Flags().String("systems", "", "use these systems only")
buildisoCmd.Flags().Bool("standalone", false, "creates a standalone ISO with all required distro files, but without any added repos")
buildisoCmd.Flags().StringSlice("systems", []string{}, "use these systems only")
buildisoCmd.Flags().String("tempdir", "", "working directory")
}
Loading

0 comments on commit 4cb417e

Please sign in to comment.