[minor] basic initial structure for migoval module

This commit is contained in:
Aaron Meihm 2015-04-10 15:14:08 -05:00
Родитель 12ddd99864
Коммит 3c70552282
4 изменённых файлов: 81 добавлений и 0 удалений

Просмотреть файл

@ -105,6 +105,7 @@ go_get_agent_deps: go_get_common_deps go_get_ping_deps go_get_memory_deps
$(GOGETTER) github.com/jvehent/service-go
$(GOGETTER) camlistore.org/pkg/misc/gpgagent
$(GOGETTER) camlistore.org/pkg/misc/pinentry
$(GOGETTER) github.com/ameihm0912/mozoval/go/src/oval
ifeq ($(OS),windows)
$(GOGETTER) code.google.com/p/winsvc/eventlog
endif

Просмотреть файл

@ -9,6 +9,7 @@ import (
_ "mig/modules/agentdestroy"
_ "mig/modules/file"
_ "mig/modules/memory"
_ "mig/modules/migoval"
_ "mig/modules/netstat"
_ "mig/modules/ping"
_ "mig/modules/timedrift"

Просмотреть файл

@ -0,0 +1,40 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Contributor: Aaron Meihm ameihm@mozilla.com [:alm]
package migoval
import (
"github.com/ameihm0912/mozoval/go/src/oval"
"mig"
)
func init() {
mig.RegisterModule("migoval", func() interface{} {
return new(Runner)
})
}
type Runner struct {
Parameters Parameters
}
func (r Runner) ValidateParameters() (err error) {
return
}
type Results struct {
}
type Parameters struct {
modePkgList bool `json:"pkglistmode"`
}
func newParameters() *Parameters {
return &Parameters{}
}
func migovalInitialize() {
oval.Init()
}

Просмотреть файл

@ -0,0 +1,39 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Contributor: Aaron Meihm ameihm@mozilla.com [:alm]
package migoval
import (
"flag"
"fmt"
)
func printHelp() {
fmt.Printf("No help is available - good luck!\n")
}
func (r Runner) ParamsParser(args []string) (interface{}, error) {
var (
fs flag.FlagSet
pkglist bool
)
if len(args) < 1 || args[0] == "" || args[0] == "help" {
printHelp()
return nil, nil
}
fs.Init("migoval", flag.ContinueOnError)
fs.BoolVar(&pkglist, "pkglist", true, "see help")
err := fs.Parse(args)
if err != nil {
return nil, err
}
p := newParameters()
r.Parameters = *p
return r.Parameters, r.ValidateParameters()
}