зеркало из https://github.com/mozilla/mig.git
[minor] basic initial structure for migoval module
This commit is contained in:
Родитель
12ddd99864
Коммит
3c70552282
1
Makefile
1
Makefile
|
@ -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()
|
||||
}
|
Загрузка…
Ссылка в новой задаче