Skip to content

Commit

Permalink
🧹 refactor provisioner into its own package (#4)
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Hartmann <[email protected]>
  • Loading branch information
chris-rock authored Jun 16, 2022
1 parent ee09469 commit 1797f5f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
5 changes: 2 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package main

//go:generate go run github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc mapstructure-to-hcl2 -type Config,SudoConfig

import (
"fmt"
"os"

"github.com/hashicorp/packer-plugin-sdk/plugin"
"go.mondoo.com/packer-plugin-mondoo/provisioner"
"go.mondoo.com/packer-plugin-mondoo/version"
)

func main() {
pps := plugin.NewSet()
pps.RegisterProvisioner(plugin.DEFAULT_NAME, new(Provisioner))
pps.RegisterProvisioner(plugin.DEFAULT_NAME, new(provisioner.Provisioner))
pps.SetVersion(version.PluginVersion)
err := pps.Run()

Expand Down
2 changes: 1 addition & 1 deletion buildinfo.go → provisioner/buildinfo.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package provisioner

// https://www.packer.io/docs/templates/legacy_json_templates/engine
type BuildInfo struct {
Expand Down
2 changes: 1 addition & 1 deletion buildinfo_test.go → provisioner/buildinfo_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package provisioner

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion mondoo.go → provisioner/mondoo.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package provisioner

type VulnOpts struct {
Assets []*Asset `json:"assets,omitempty" mapstructure:"assets"`
Expand Down
4 changes: 3 additions & 1 deletion provisioner.go → provisioner/provisioner.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package main
package provisioner

//go:generate go run github.com/hashicorp/packer-plugin-sdk/cmd/packer-sdc mapstructure-to-hcl2 -type Config,SudoConfig

import (
"bufio"
Expand Down
2 changes: 1 addition & 1 deletion main.hcl2spec.go → provisioner/provisioner.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sshkey.go → provisioner/sshkey.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package provisioner

import (
"crypto/rand"
Expand Down

0 comments on commit 1797f5f

Please sign in to comment.