update vendor
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
19a32db84d
commit
94d1cfbfbf
10501 changed files with 2307943 additions and 29279 deletions
52
vendor/github.com/containerd/continuity/commands/apply.go
generated
vendored
Normal file
52
vendor/github.com/containerd/continuity/commands/apply.go
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
|
||||
"github.com/containerd/continuity"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var ApplyCmd = &cobra.Command{
|
||||
Use: "apply <root> [<manifest>]",
|
||||
Short: "Apply the manifest to the provided root",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
root, path := args[0], args[1]
|
||||
|
||||
p, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
log.Fatalf("error reading manifest: %v", err)
|
||||
}
|
||||
|
||||
m, err := continuity.Unmarshal(p)
|
||||
if err != nil {
|
||||
log.Fatalf("error unmarshaling manifest: %v", err)
|
||||
}
|
||||
|
||||
ctx, err := continuity.NewContext(root)
|
||||
if err != nil {
|
||||
log.Fatalf("error getting context: %v", err)
|
||||
}
|
||||
|
||||
if err := continuity.ApplyManifest(ctx, m); err != nil {
|
||||
log.Fatalf("error applying manifest: %v", err)
|
||||
}
|
||||
},
|
||||
}
|
64
vendor/github.com/containerd/continuity/commands/build.go
generated
vendored
Normal file
64
vendor/github.com/containerd/continuity/commands/build.go
generated
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/containerd/continuity"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
buildCmdConfig struct {
|
||||
format string
|
||||
}
|
||||
|
||||
BuildCmd = &cobra.Command{
|
||||
Use: "build <root>",
|
||||
Short: "Build a manifest for the provided root",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args) != 1 {
|
||||
log.Fatalln("please specify a root")
|
||||
}
|
||||
|
||||
ctx, err := continuity.NewContext(args[0])
|
||||
if err != nil {
|
||||
log.Fatalf("error creating path context: %v", err)
|
||||
}
|
||||
|
||||
m, err := continuity.BuildManifest(ctx)
|
||||
if err != nil {
|
||||
log.Fatalf("error generating manifest: %v", err)
|
||||
}
|
||||
|
||||
p, err := continuity.Marshal(m)
|
||||
if err != nil {
|
||||
log.Fatalf("error marshaling manifest: %v", err)
|
||||
}
|
||||
|
||||
if _, err := os.Stdout.Write(p); err != nil {
|
||||
log.Fatalf("error writing to stdout: %v", err)
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
BuildCmd.Flags().StringVar(&buildCmdConfig.format, "format", "pb", "specify the output format of the manifest")
|
||||
}
|
60
vendor/github.com/containerd/continuity/commands/dump.go
generated
vendored
Normal file
60
vendor/github.com/containerd/continuity/commands/dump.go
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
pb "github.com/containerd/continuity/proto"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var DumpCmd = &cobra.Command{
|
||||
Use: "dump <manifest>",
|
||||
Short: "Dump the contents of the manifest in protobuf text format",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var p []byte
|
||||
var err error
|
||||
|
||||
if len(args) < 1 {
|
||||
p, err = ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
log.Fatalf("error reading manifest: %v", err)
|
||||
}
|
||||
} else {
|
||||
p, err = ioutil.ReadFile(args[0])
|
||||
if err != nil {
|
||||
log.Fatalf("error reading manifest: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
var bm pb.Manifest
|
||||
|
||||
if err := proto.Unmarshal(p, &bm); err != nil {
|
||||
log.Fatalf("error unmarshaling manifest: %v", err)
|
||||
}
|
||||
|
||||
// TODO(stevvooe): For now, just dump the text format. Turn this into
|
||||
// nice text output later.
|
||||
if err := proto.MarshalText(os.Stdout, &bm); err != nil {
|
||||
log.Fatalf("error dumping manifest: %v", err)
|
||||
}
|
||||
},
|
||||
}
|
57
vendor/github.com/containerd/continuity/commands/ls.go
generated
vendored
Normal file
57
vendor/github.com/containerd/continuity/commands/ls.go
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"text/tabwriter"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var LSCmd = &cobra.Command{
|
||||
Use: "ls <manifest>",
|
||||
Short: "List the contents of the manifest.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args) != 1 {
|
||||
log.Fatalln("please specify a manifest")
|
||||
}
|
||||
|
||||
bm, err := readManifestFile(args[0])
|
||||
if err != nil {
|
||||
log.Fatalf("error reading manifest: %v", err)
|
||||
}
|
||||
|
||||
w := tabwriter.NewWriter(os.Stdout, 0, 2, 2, ' ', 0)
|
||||
|
||||
for _, entry := range bm.Resource {
|
||||
for _, path := range entry.Path {
|
||||
if os.FileMode(entry.Mode)&os.ModeSymlink != 0 {
|
||||
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v -> %v\n", os.FileMode(entry.Mode), entry.User, entry.Group, humanize.Bytes(uint64(entry.Size)), path, entry.Target)
|
||||
} else {
|
||||
fmt.Fprintf(w, "%v\t%v\t%v\t%v\t%v\n", os.FileMode(entry.Mode), entry.User, entry.Group, humanize.Bytes(uint64(entry.Size)), path)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
w.Flush()
|
||||
},
|
||||
}
|
98
vendor/github.com/containerd/continuity/commands/main.go
generated
vendored
Normal file
98
vendor/github.com/containerd/continuity/commands/main.go
generated
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"text/tabwriter"
|
||||
|
||||
pb "github.com/containerd/continuity/proto"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
MainCmd = &cobra.Command{
|
||||
Use: "continuity <command>",
|
||||
Short: "A transport-agnostic filesytem metadata tool.",
|
||||
}
|
||||
|
||||
// usageTemplate is nearly identical to the default template without the
|
||||
// automatic addition of flags. Instead, Command.Use is used unmodified.
|
||||
usageTemplate = `Usage:{{if .Runnable}}
|
||||
{{.UseLine}}{{end}}{{if .HasSubCommands}}
|
||||
{{ .CommandPath}} [command]{{end}}{{if gt .Aliases 0}}
|
||||
|
||||
Aliases:
|
||||
{{.NameAndAliases}}
|
||||
{{end}}{{if .HasExample}}
|
||||
|
||||
Examples:
|
||||
{{ .Example }}{{end}}{{ if .HasAvailableSubCommands}}
|
||||
|
||||
Available Commands:{{range .Commands}}{{if .IsAvailableCommand}}
|
||||
{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasLocalFlags}}
|
||||
|
||||
Flags:
|
||||
{{.LocalFlags.FlagUsages | trimRightSpace}}{{end}}{{ if .HasInheritedFlags}}
|
||||
|
||||
Global Flags:
|
||||
{{.InheritedFlags.FlagUsages | trimRightSpace}}{{end}}{{if .HasHelpSubCommands}}
|
||||
|
||||
Additional help topics:{{range .Commands}}{{if .IsHelpCommand}}
|
||||
{{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{ if .HasSubCommands }}
|
||||
|
||||
Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}}
|
||||
`
|
||||
)
|
||||
|
||||
func init() {
|
||||
MainCmd.AddCommand(BuildCmd)
|
||||
MainCmd.AddCommand(VerifyCmd)
|
||||
MainCmd.AddCommand(ApplyCmd)
|
||||
MainCmd.AddCommand(LSCmd)
|
||||
MainCmd.AddCommand(StatsCmd)
|
||||
MainCmd.AddCommand(DumpCmd)
|
||||
if MountCmd != nil {
|
||||
MainCmd.AddCommand(MountCmd)
|
||||
}
|
||||
MainCmd.SetUsageTemplate(usageTemplate)
|
||||
}
|
||||
|
||||
// readManifestFile reads the manifest from the given path. This should
|
||||
// probably be provided by the continuity library.
|
||||
func readManifestFile(path string) (*pb.Manifest, error) {
|
||||
p, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var bm pb.Manifest
|
||||
|
||||
if err := proto.Unmarshal(p, &bm); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &bm, nil
|
||||
}
|
||||
|
||||
// newTabwriter provides a common tabwriter with defaults.
|
||||
func newTabwriter(w io.Writer) *tabwriter.Writer {
|
||||
return tabwriter.NewWriter(os.Stdout, 0, 2, 2, ' ', 0)
|
||||
}
|
131
vendor/github.com/containerd/continuity/commands/mount.go
generated
vendored
Normal file
131
vendor/github.com/containerd/continuity/commands/mount.go
generated
vendored
Normal file
|
@ -0,0 +1,131 @@
|
|||
// +build linux darwin freebsd
|
||||
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"bazil.org/fuse"
|
||||
"bazil.org/fuse/fs"
|
||||
|
||||
"github.com/containerd/continuity"
|
||||
"github.com/containerd/continuity/continuityfs"
|
||||
"github.com/containerd/continuity/driver"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var MountCmd = &cobra.Command{
|
||||
Use: "mount <mountpoint> [<manifest>] [<source directory>]",
|
||||
Short: "Mount the manifest to the provided mountpoint using content from a source directory",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args) != 3 {
|
||||
log.Fatal("Must specify mountpoint, manifest, and source directory")
|
||||
}
|
||||
mountpoint := args[0]
|
||||
manifest, source := args[1], args[2]
|
||||
|
||||
manifestName := filepath.Base(manifest)
|
||||
|
||||
p, err := ioutil.ReadFile(manifest)
|
||||
if err != nil {
|
||||
log.Fatalf("error reading manifest: %v", err)
|
||||
}
|
||||
|
||||
m, err := continuity.Unmarshal(p)
|
||||
if err != nil {
|
||||
log.Fatalf("error unmarshaling manifest: %v", err)
|
||||
}
|
||||
|
||||
driver, err := driver.NewSystemDriver()
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
provider := continuityfs.NewFSFileContentProvider(source, driver)
|
||||
|
||||
contfs, err := continuityfs.NewFSFromManifest(m, mountpoint, provider)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
c, err := fuse.Mount(
|
||||
mountpoint,
|
||||
fuse.ReadOnly(),
|
||||
fuse.FSName(manifestName),
|
||||
fuse.Subtype("continuity"),
|
||||
// OSX Only options
|
||||
fuse.LocalVolume(),
|
||||
fuse.VolumeName("Continuity FileSystem"),
|
||||
)
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
<-c.Ready
|
||||
if err := c.MountError; err != nil {
|
||||
c.Close()
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
// TODO: Create server directory to use context
|
||||
err = fs.Serve(c, contfs)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
}()
|
||||
|
||||
sigChan := make(chan os.Signal, 1)
|
||||
signal.Notify(sigChan, os.Interrupt)
|
||||
signal.Notify(sigChan, syscall.SIGTERM)
|
||||
|
||||
select {
|
||||
case <-sigChan:
|
||||
logrus.Infof("Shutting down")
|
||||
case err = <-errChan:
|
||||
}
|
||||
|
||||
go func() {
|
||||
if err := c.Close(); err != nil {
|
||||
logrus.Errorf("Unable to close connection %s", err)
|
||||
}
|
||||
}()
|
||||
|
||||
// Wait for any inprogress requests to be handled
|
||||
time.Sleep(time.Second)
|
||||
|
||||
logrus.Infof("Attempting unmount")
|
||||
if err := fuse.Unmount(mountpoint); err != nil {
|
||||
logrus.Errorf("Error unmounting %s: %v", mountpoint, err)
|
||||
}
|
||||
|
||||
// Handle server error
|
||||
if err != nil {
|
||||
logrus.Fatalf("Error serving fuse server: %v", err)
|
||||
}
|
||||
},
|
||||
}
|
25
vendor/github.com/containerd/continuity/commands/mount_unsupported.go
generated
vendored
Normal file
25
vendor/github.com/containerd/continuity/commands/mount_unsupported.go
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
// +build windows solaris
|
||||
|
||||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var MountCmd *cobra.Command = nil
|
74
vendor/github.com/containerd/continuity/commands/stats.go
generated
vendored
Normal file
74
vendor/github.com/containerd/continuity/commands/stats.go
generated
vendored
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var (
|
||||
StatsCmd = &cobra.Command{
|
||||
Use: "stats <manifest>",
|
||||
Short: "display statistics about the specified manifest",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args) != 1 {
|
||||
log.Fatalln("please specify a manifest")
|
||||
}
|
||||
|
||||
bm, err := readManifestFile(args[0])
|
||||
if err != nil {
|
||||
log.Fatalf("error reading manifest: %v", err)
|
||||
}
|
||||
|
||||
var stats struct {
|
||||
resources int
|
||||
files int
|
||||
directories int
|
||||
totalSize int64
|
||||
symlinks int
|
||||
}
|
||||
|
||||
for _, entry := range bm.Resource {
|
||||
stats.resources++
|
||||
stats.totalSize += int64(entry.Size)
|
||||
|
||||
mode := os.FileMode(entry.Mode)
|
||||
if mode.IsRegular() {
|
||||
stats.files += len(entry.Path) // count hardlinks!
|
||||
} else if mode.IsDir() {
|
||||
stats.directories++
|
||||
} else if mode&os.ModeSymlink != 0 {
|
||||
stats.symlinks++
|
||||
}
|
||||
}
|
||||
|
||||
w := newTabwriter(os.Stdout)
|
||||
defer w.Flush()
|
||||
|
||||
fmt.Fprintf(w, "resources\t%v\n", stats.resources)
|
||||
fmt.Fprintf(w, "directories\t%v\n", stats.directories)
|
||||
fmt.Fprintf(w, "files\t%v\n", stats.files)
|
||||
fmt.Fprintf(w, "symlinks\t%v\n", stats.symlinks)
|
||||
fmt.Fprintf(w, "size\t%v\n", humanize.Bytes(uint64(stats.totalSize)))
|
||||
},
|
||||
}
|
||||
)
|
57
vendor/github.com/containerd/continuity/commands/verify.go
generated
vendored
Normal file
57
vendor/github.com/containerd/continuity/commands/verify.go
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
Copyright The containerd Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package commands
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
|
||||
"github.com/containerd/continuity"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var VerifyCmd = &cobra.Command{
|
||||
Use: "verify <root> [<manifest>]",
|
||||
Short: "Verify the root against the provided manifest",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if len(args) != 2 {
|
||||
log.Fatalln("please specify a root and manifest")
|
||||
}
|
||||
|
||||
root, path := args[0], args[1]
|
||||
|
||||
p, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
log.Fatalf("error reading manifest: %v", err)
|
||||
}
|
||||
|
||||
m, err := continuity.Unmarshal(p)
|
||||
if err != nil {
|
||||
log.Fatalf("error unmarshaling manifest: %v", err)
|
||||
}
|
||||
|
||||
ctx, err := continuity.NewContext(root)
|
||||
if err != nil {
|
||||
log.Fatalf("error getting context: %v", err)
|
||||
}
|
||||
|
||||
if err := continuity.VerifyManifest(ctx, m); err != nil {
|
||||
// TODO(stevvooe): Support more interesting error reporting.
|
||||
log.Fatalf("error verifying manifest: %v", err)
|
||||
}
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue