Пример #1
0
// PrintFS prints etcd key/values from local fs
func PrintFS(context *cli.Context) {
	namespace := context.GlobalString("namespace")
	localPath := context.GlobalString("local-path")
	useTable := context.Bool("table")
	includeDirs := context.Bool("include-directories")
	localEtcdFS := fs.New(localPath)

	keyValues, err := localEtcdFS.KeyValuePairs(namespace, includeDirs)
	FatalIfError("localEtcdFS.KeyValuePairs", err)

	printKeyValuePairs(useTable, keyValues)
}
Пример #2
0
// Dump dumps remote etcd pairs into the local filesystem
func Dump(context *cli.Context) {
	namespace := context.GlobalString("namespace")
	localPath := context.GlobalString("local-path")
	etcdURI := context.GlobalString("etcd-uri")

	etcdClient, err := etcd.Dial(etcdURI, nil)
	FatalIfError("etcd.Dial", err)

	keyValues, err := etcdClient.KeyValuePairs(namespace)
	FatalIfError("etcdClient.KeyValuePairs", err)

	localEtcdFS := fs.New(localPath)
	err = localEtcdFS.SetAll(keyValues)
	FatalIfError("localEtcdFS.SetAll", err)

	os.Exit(0)
}
Пример #3
0
// Load dumps remote etcd pairs into the local filesystem
func Load(context *cli.Context) {
	namespace := context.GlobalString("namespace")
	localPath := context.GlobalString("local-path")
	etcdURI := context.GlobalString("etcd-uri")
	includeDirs := context.Bool("include-directories")

	localEtcdFS := fs.New(localPath)
	keyValues, err := localEtcdFS.KeyValuePairs(namespace, includeDirs)
	FatalIfError("localEtcdFS.KeyValuePairs", err)

	etcdClient, err := etcd.Dial(etcdURI, nil)
	FatalIfError("etcd.Dial", err)
	err = etcdClient.SetAll(keyValues)
	FatalIfError("etcdClient.SetAll", err)

	os.Exit(0)
}