Esempio n. 1
0
File: pod.go Progetto: petertseng/p2
	"github.com/square/p2/pkg/p2exec"
	"github.com/square/p2/pkg/runit"
	"github.com/square/p2/pkg/types"
	"github.com/square/p2/pkg/uri"
	"github.com/square/p2/pkg/user"
	"github.com/square/p2/pkg/util"
	"github.com/square/p2/pkg/util/param"
	"github.com/square/p2/pkg/util/size"

	"github.com/Sirupsen/logrus"
)

var (
	// ExperimentalOpencontainer permits the use of the experimental "opencontainer"
	// launchable type.
	ExperimentalOpencontainer = param.Bool("experimental_opencontainer", false)

	// NestedCgroups causes the p2-preparer to use a hierarchical cgroup naming scheme when
	// creating new launchables.
	NestedCgroups = param.Bool("nested_cgroups", false)
)

const (
	ConfigPathEnvVar         = "CONFIG_PATH"
	LaunchableIDEnvVar       = "LAUNCHABLE_ID"
	LaunchableRootEnvVar     = "LAUNCHABLE_ROOT"
	PodIDEnvVar              = "POD_ID"
	PodHomeEnvVar            = "POD_HOME"
	PodUniqueKeyEnvVar       = "POD_UNIQUE_KEY"
	PlatformConfigPathEnvVar = "PLATFORM_CONFIG_PATH"
)
Esempio n. 2
0
package consulutil

import (
	"errors"
	"fmt"
	"path/filepath"
	"runtime"

	"github.com/hashicorp/consul/api"

	"github.com/square/p2/pkg/util/param"
)

// Show detailed error messages from Consul (use only when debugging)
var showConsulErrors = param.Bool("show_consul_errors_unsafe", false)

// KVError encapsulates an error in a Store operation. Errors returned from the
// Consul API cannot be exposed because they may contain the URL of the request,
// which includes an ACL token as a query parameter.
type KVError struct {
	Op          string
	Key         string
	UnsafeError error
	filename    string
	function    string
	lineNumber  int
}

// Error implements the error and "pkg/util".CallsiteError interfaces.
func (err KVError) Error() string {
	cerr := ""
Esempio n. 3
0
File: pod.go Progetto: tomzhang/p2
	"github.com/square/p2/pkg/opencontainer"
	"github.com/square/p2/pkg/runit"
	"github.com/square/p2/pkg/uri"
	"github.com/square/p2/pkg/user"
	"github.com/square/p2/pkg/util"
	"github.com/square/p2/pkg/util/param"

	"github.com/square/p2/Godeps/_workspace/src/github.com/Sirupsen/logrus"
)

var (
	Log logging.Logger

	// ExperimentalOpencontainer permits the use of the experimental "opencontainer"
	// launcahble type.
	ExperimentalOpencontainer = param.Bool("experimental_opencontainer", false)
)

const DEFAULT_PATH = "/data/pods"

var DefaultP2Exec = "/usr/local/bin/p2-exec"

func init() {
	Log = logging.NewLogger(logrus.Fields{})
}

func PodPath(root, manifestId string) string {
	return filepath.Join(root, manifestId)
}

type Pod struct {