本文整理匯總了Golang中github.com/eris-ltd/eris-cli/util.DockerConnect函數的典型用法代碼示例。如果您正苦於以下問題:Golang DockerConnect函數的具體用法?Golang DockerConnect怎麽用?Golang DockerConnect使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DockerConnect函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: testsInit
func testsInit() error {
var err error
// TODO: make a reader/pipe so we can see what is written from tests.
util.GlobalConfig, err = util.SetGlobalObject(os.Stdout, os.Stderr)
if err != nil {
ifExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
}
// common is initialized on import so
// we have to manually override these
// variables to ensure that the tests
// run correctly.
util.ChangeErisDir(erisDir)
// init dockerClient
util.DockerConnect(false, "eris")
// this dumps the ipfs service def into the temp dir which
// has been set as the erisRoot
if err := ini.Initialize(true, false); err != nil {
ifExit(fmt.Errorf("TRAGIC. Could not initialize the eris dir.\n"))
}
return nil
}
示例2: testsInit
func testsInit() error {
var err error
// TODO: make a reader/pipe so we can see what is written from tests.
config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
if err != nil {
ifExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
}
// common is initialized on import so
// we have to manually override these
// variables to ensure that the tests
// run correctly.
config.ChangeErisDir(erisDir)
// init dockerClient
util.DockerConnect(false, "eris-test-nyc2-1.8.1")
// this dumps the ipfs service def into the temp dir which
// has been set as the erisRoot
do := def.NowDo()
do.Pull = true
do.Services = true
do.Actions = true
if err := ini.Initialize(do); err != nil {
ifExit(fmt.Errorf("TRAGIC. Could not initialize the eris dir.\n"))
}
// lay a chain service def
testNewChain(chainName)
return nil
}
示例3: testsInit
func testsInit() error {
var err error
// TODO: make a reader/pipe so we can see what is written from tests.
config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
ifExit(err)
// common is initialized on import so
// we have to manually override these
// variables to ensure that the tests
// run correctly.
config.ChangeErisDir(erisDir)
// init dockerClient
util.DockerConnect(false, "eris")
// this dumps the ipfs service def into the temp dir which
// has been set as the erisRoot
do := definitions.NowDo()
do.Pull = true
do.Services = true
do.Actions = true
ifExit(ini.Initialize(do))
// dump a test file with some stuff
f, err := os.Create(file)
ifExit(err)
f.Write([]byte(content))
return nil
}
示例4: TestsInit
//testType = one of each package, will switch over it for
//make additional tempDirs and vars as needed -> [zr] or not, TBD
func TestsInit(testType string) (err error) {
// TODO: make a reader/pipe so we can see what is written from tests.
config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
if err != nil {
IfExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
}
// common is initialized on import so
// we have to manually override these
// variables to ensure that the tests
// run correctly.
config.ChangeErisDir(erisDir)
util.DockerConnect(false, "eris")
// this dumps the ipfs and keys services defs into the temp dir which
// has been set as the erisRoot.
do := def.NowDo()
do.Pull = true
do.Services = true
do.Actions = true
do.Yes = true
if err := ini.Initialize(do); err != nil {
IfExit(fmt.Errorf("TRAGIC. Could not initialize the eris dir.\n"))
}
if testType == "services" {
checkIPFSnotRunning() //TODO make more general & use for other things?
}
logger.Infoln("Test init completed. Starting main test sequence now.")
return nil
}
示例5: TestsInit
//testType = one of each package, will switch over it for
//make additional tempDirs and vars as needed -> [zr] or not, TBD
func TestsInit(testType string) (err error) {
// TODO: make a reader/pipe so we can see what is written from tests.
config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
if err != nil {
IfExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
}
// common is initialized on import so
// we have to manually override these
// variables to ensure that the tests
// run correctly.
config.ChangeErisDir(erisDir)
util.DockerConnect(false, "eris")
// this dumps the ipfs and keys services defs into the temp dir which
// has been set as the erisRoot.
do := def.NowDo()
do.Pull = false //don't pull imgs
do.Yes = true //over-ride command-line prompts
do.Quiet = true
// do.Source = "toadserver" //use "rawgit" if ts down
do.Source = "rawgit" //use "rawgit" if ts down
if err := ini.Initialize(do); err != nil {
IfExit(fmt.Errorf("TRAGIC. Could not initialize the eris dir: %s.\n", err))
}
log.Info("Test init completed. Starting main test sequence now")
return nil
}
示例6: testsInit
func testsInit() error {
var err error
// TODO: make a reader/pipe so we can see what is written from tests.
config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
ifExit(err)
// common is initialized on import so
// we have to manually override these
// variables to ensure that the tests
// run correctly.
config.ChangeErisDir(erisDir)
// init dockerClient
util.DockerConnect(false, "eris")
// this dumps the ipfs service def into the temp dir which
// has been set as the erisRoot
ifExit(ini.Initialize(true, false))
// set ipfs endpoint
// os.Setenv("ERIS_IPFS_HOST", "http://0.0.0.0") // conflicts with docker-machine based testing
// dump a test file with some stuff
f, err := os.Create(file)
ifExit(err)
f.Write([]byte(content))
return nil
}
示例7: testsInit
func testsInit() error {
var err error
// TODO: make a reader/pipe so we can see what is written from tests.
config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
ifExit(err)
// common is initialized on import so
// we have to manually override these
// variables to ensure that the tests
// run correctly.
config.ChangeErisDir(erisDir)
// init dockerClient
util.DockerConnect(false, "eris")
// this dumps the ipfs service def into the temp dir which
// has been set as the erisRoot
do := def.NowDo()
do.Pull = true
do.Services = true
do.Actions = true
ifExit(ini.Initialize(do))
// set ipfs endpoint
//os.Setenv("ERIS_IPFS_HOST", "http://0.0.0.0") //conflicts with docker-machine
// make sure ipfs not running
do = def.NowDo()
do.Quiet = true
logger.Debugln("Finding the running services.")
if err := ListRunning(do); err != nil {
ifExit(err)
}
res := strings.Split(do.Result, "\n")
for _, r := range res {
if r == "ipfs" {
ifExit(fmt.Errorf("IPFS service is running.\nPlease stop it with.\neris services stop -rx ipfs\n"))
}
}
// make sure ipfs container does not exist
do = def.NowDo()
do.Quiet = true
if err := ListExisting(do); err != nil {
ifExit(err)
}
res = strings.Split(do.Result, "\n")
for _, r := range res {
if r == "ipfs" {
ifExit(fmt.Errorf("IPFS service exists.\nPlease remove it with\neris services rm ipfs\n"))
}
}
logger.Infoln("Test init completed. Starting main test sequence now.")
return nil
}
示例8: testsInit
func testsInit() error {
var err error
config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
if err != nil {
ifExit(fmt.Errorf("TRAGIC. Could not set global config.\n"))
}
// common is initialized on import so
// we have to manually override these
// variables to ensure that the tests
// run correctly.
config.ChangeErisDir(erisDir)
util.DockerConnect(false, "eris")
log.Info("Test init completed. Starting main test sequence now.")
return nil
}
示例9: testsInit
func testsInit() error {
var err error
// TODO: make a reader/pipe so we can see what is written from tests.
config.GlobalConfig, err = config.SetGlobalObject(os.Stdout, os.Stderr)
ifExit(err)
config.ChangeErisDir(erisDir)
// init dockerClient
util.DockerConnect(false, "eris")
// clone bank...for now.
// TODO: add better tester
// this dumps the ipfs service def into the temp dir which
// has been set as the erisRoot
ifExit(ini.Initialize(true, false))
logger.Infoln("Test init completed. Starting main test sequence now.")
return nil
}
示例10:
Made with <3 by Eris Industries.
Complete documentation is available at https://docs.erisindustries.com
` + "\nVersion:\n " + VERSION,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
var logLevel log.LogLevel
if do.Verbose {
logLevel = 2
} else if do.Debug {
logLevel = 3
}
log.SetLoggers(logLevel, config.GlobalConfig.Writer, config.GlobalConfig.ErrorWriter)
ipfs.IpfsHost = config.GlobalConfig.Config.IpfsHost
util.DockerConnect(do.Verbose, do.MachineName)
dockerVersion, _ := util.DockerClientVersion()
marmot := "Come back after you have upgraded and the marmots will be happy to service your blockchain management needs"
if dockerVersion < dVerMin {
IfExit(fmt.Errorf("Eris requires docker version >= %v\nThe marmots have detected docker version: %v\n%s", dVerMin, dockerVersion, marmot))
}
},
PersistentPostRun: func(cmd *cobra.Command, args []string) {
err := config.SaveGlobalConfig(config.GlobalConfig.Config)
if err != nil {
logger.Errorln(err)
}
log.Flush()
},
}