Merge pull request #412 from harshavardhana/pr_out_migrate_config_to_qdb
Migrate config to qdb
This commit is contained in:
@@ -46,6 +46,9 @@ func aliasExpand(aliasedURL string, aliases map[string]string) (newURL string, e
|
||||
}
|
||||
|
||||
for aliasName, expandedURL := range aliases {
|
||||
if !isValidAliasName(aliasName) {
|
||||
return "", iodine.New(errInvalidAliasName{alias: aliasName}, nil)
|
||||
}
|
||||
if strings.HasPrefix(aliasedURL, aliasName) {
|
||||
// Match found. Expand it.
|
||||
splits := strings.Split(aliasedURL, ":")
|
||||
|
||||
+8
-5
@@ -21,13 +21,14 @@ import (
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"io"
|
||||
|
||||
"github.com/cheggaaa/pb"
|
||||
"github.com/minio-io/mc/pkg/client"
|
||||
"github.com/minio-io/mc/pkg/client/fs"
|
||||
"github.com/minio-io/mc/pkg/client/s3"
|
||||
"github.com/minio-io/mc/pkg/console"
|
||||
"github.com/minio-io/minio/pkg/iodine"
|
||||
"io"
|
||||
)
|
||||
|
||||
// StartBar -- instantiate a progressbar
|
||||
@@ -116,13 +117,15 @@ func (manager mcClientManager) getNewClient(urlStr string, debug bool) (clnt cli
|
||||
if err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
}
|
||||
if hostCfg.Auth == nil {
|
||||
if hostCfg == nil {
|
||||
return nil, iodine.New(errInvalidAuth{}, nil)
|
||||
}
|
||||
auth := new(s3.Auth)
|
||||
if hostCfg.Auth.AccessKeyID != "" || hostCfg.Auth.SecretAccessKey != "" {
|
||||
auth.AccessKeyID = hostCfg.Auth.AccessKeyID
|
||||
auth.SecretAccessKey = hostCfg.Auth.SecretAccessKey
|
||||
if _, ok := hostCfg["Auth.AccessKeyID"]; ok {
|
||||
auth.AccessKeyID = hostCfg["Auth.AccessKeyID"]
|
||||
}
|
||||
if _, ok := hostCfg["Auth.SecretAccessKey"]; ok {
|
||||
auth.SecretAccessKey = hostCfg["Auth.SecretAccessKey"]
|
||||
}
|
||||
clnt = s3.GetNewClient(urlStr, auth, mcUserAgent, debug)
|
||||
return clnt, nil
|
||||
|
||||
+77
-176
@@ -18,19 +18,18 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/minio-io/cli"
|
||||
"github.com/minio-io/mc/pkg/console"
|
||||
"github.com/minio-io/mc/pkg/qdb"
|
||||
"github.com/minio-io/minio/pkg/iodine"
|
||||
"github.com/minio-io/minio/pkg/utils/log"
|
||||
)
|
||||
@@ -38,26 +37,11 @@ import (
|
||||
const (
|
||||
mcConfigDir = ".mc/"
|
||||
mcConfigWindowsDir = "mc/"
|
||||
configFile = "config.json"
|
||||
mcConfigFile = "config.json"
|
||||
)
|
||||
|
||||
type auth struct {
|
||||
AccessKeyID string
|
||||
SecretAccessKey string
|
||||
}
|
||||
|
||||
type hostConfig struct {
|
||||
Auth *auth
|
||||
}
|
||||
|
||||
type mcConfig struct {
|
||||
Version uint
|
||||
Hosts map[string]hostConfig
|
||||
Aliases map[string]string
|
||||
}
|
||||
|
||||
const (
|
||||
currentConfigVersion = 1
|
||||
var (
|
||||
mcCurrentConfigVersion = qdb.Version{Major: 1, Minor: 0, Patch: 0}
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -67,16 +51,12 @@ const (
|
||||
secretAccesskey = "YOUR-SECRET-ACCESS-KEY-HERE"
|
||||
)
|
||||
|
||||
// Global config data loaded from json config file durlng init(). This variable should only
|
||||
// be accessed via getMcConfig()
|
||||
var _config *mcConfig
|
||||
|
||||
func getMcConfigDir() (string, error) {
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
return "", iodine.New(err, nil)
|
||||
}
|
||||
// For windows the path is slightly differently
|
||||
// For windows the path is slightly different
|
||||
switch runtime.GOOS {
|
||||
case "windows":
|
||||
return path.Join(u.HomeDir, mcConfigWindowsDir), nil
|
||||
@@ -85,16 +65,16 @@ func getMcConfigDir() (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func getOrCreateMcConfigDir() (string, error) {
|
||||
func createMcConfigDir() error {
|
||||
p, err := getMcConfigDir()
|
||||
if err != nil {
|
||||
return "", iodine.New(err, nil)
|
||||
return iodine.New(err, nil)
|
||||
}
|
||||
err = os.MkdirAll(p, 0700)
|
||||
if err != nil {
|
||||
return "", iodine.New(err, nil)
|
||||
return iodine.New(err, nil)
|
||||
}
|
||||
return p, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func getMcConfigPath() (string, error) {
|
||||
@@ -102,7 +82,7 @@ func getMcConfigPath() (string, error) {
|
||||
if err != nil {
|
||||
return "", iodine.New(err, nil)
|
||||
}
|
||||
return path.Join(dir, configFile), nil
|
||||
return path.Join(dir, mcConfigFile), nil
|
||||
}
|
||||
|
||||
func mustGetMcConfigPath() string {
|
||||
@@ -110,21 +90,25 @@ func mustGetMcConfigPath() string {
|
||||
return p
|
||||
}
|
||||
|
||||
// getMcConfig returns the config data from file. Subsequent calls are
|
||||
// cached in a private global variable
|
||||
func getMcConfig() (cfg *mcConfig, err error) {
|
||||
if _config != nil {
|
||||
return _config, nil
|
||||
// getMcConfig returns the config
|
||||
func getMcConfig() (config qdb.Store, err error) {
|
||||
if !isMcConfigExist() {
|
||||
return nil, iodine.New(errInvalidArgument{}, nil)
|
||||
}
|
||||
_config, err = loadMcConfig()
|
||||
configFile, err := getMcConfigPath()
|
||||
if err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
}
|
||||
return _config, nil
|
||||
if configStore := qdb.NewStore(mcCurrentConfigVersion); configStore != nil {
|
||||
if err := configStore.Load(configFile); err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
}
|
||||
return configStore, nil
|
||||
}
|
||||
return nil, iodine.New(errInvalidArgument{}, nil)
|
||||
}
|
||||
|
||||
// getMcConfig returns the config data from file. Subsequent calls are
|
||||
// cached in a private global variable
|
||||
// isMcConfigExist returns true/false if config exists
|
||||
func isMcConfigExist() bool {
|
||||
configFile, err := getMcConfigPath()
|
||||
if err != nil {
|
||||
@@ -137,65 +121,9 @@ func isMcConfigExist() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// chechMcConfig checks for errors in config file
|
||||
func checkMcConfig(config *mcConfig) (err error) {
|
||||
// check for version
|
||||
switch {
|
||||
case (config.Version != currentConfigVersion):
|
||||
return iodine.New(errUnsupportedVersion{old: currentConfigVersion, new: config.Version}, nil)
|
||||
case len(config.Hosts) > 1:
|
||||
for host, hostCfg := range config.Hosts {
|
||||
// don't need to check for availability of AccessKeyID, not having one
|
||||
// is a valid case for public buckets
|
||||
if host == "" {
|
||||
return iodine.New(errEmptyURL{}, nil)
|
||||
}
|
||||
if hostCfg.Auth == nil {
|
||||
return iodine.New(errInvalidAuth{}, nil)
|
||||
}
|
||||
}
|
||||
case len(config.Aliases) > 0:
|
||||
for aliasName, aliasURL := range config.Aliases {
|
||||
_, err := url.Parse(aliasURL)
|
||||
if err != nil {
|
||||
return iodine.New(errInvalidAliasURL{alias: aliasName, url: aliasURL}, nil)
|
||||
}
|
||||
if !isValidAliasName(aliasName) {
|
||||
return iodine.New(errInvalidAliasName{alias: aliasName}, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// loadMcConfig decodes json configuration file to mcConfig structure
|
||||
func loadMcConfig() (config *mcConfig, err error) {
|
||||
configFile, err := getMcConfigPath()
|
||||
if err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
}
|
||||
_, err = os.Stat(configFile)
|
||||
if err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
}
|
||||
configBytes, err := ioutil.ReadFile(configFile)
|
||||
if err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
}
|
||||
err = json.Unmarshal(configBytes, &config)
|
||||
if err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
}
|
||||
return config, nil
|
||||
}
|
||||
|
||||
// writeConfig
|
||||
func writeConfig(configData *mcConfig) error {
|
||||
jsonConfig, err := json.MarshalIndent(configData, "", "\t")
|
||||
if err != nil {
|
||||
return iodine.New(err, nil)
|
||||
}
|
||||
_, err = getOrCreateMcConfigDir()
|
||||
func writeConfig(config qdb.Store) error {
|
||||
err := createMcConfigDir()
|
||||
if err != nil {
|
||||
return iodine.New(err, nil)
|
||||
}
|
||||
@@ -203,25 +131,7 @@ func writeConfig(configData *mcConfig) error {
|
||||
if err != nil {
|
||||
return iodine.New(err, nil)
|
||||
}
|
||||
configFile, err := os.OpenFile(configPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600)
|
||||
if err != nil {
|
||||
return iodine.New(err, nil)
|
||||
}
|
||||
_, err = configFile.Write(jsonConfig)
|
||||
if err != nil {
|
||||
configFile.Close()
|
||||
return iodine.New(err, nil)
|
||||
}
|
||||
|
||||
// explicitly close config file
|
||||
configFile.Close()
|
||||
|
||||
// Invalidate cached config
|
||||
_config = nil
|
||||
|
||||
// Reload and cache new config
|
||||
_, err = getMcConfig()
|
||||
if os.IsNotExist(iodine.ToError(err)) {
|
||||
if err := config.Save(configPath); err != nil {
|
||||
return iodine.New(err, nil)
|
||||
}
|
||||
return nil
|
||||
@@ -231,46 +141,51 @@ func writeConfig(configData *mcConfig) error {
|
||||
func saveConfig(ctx *cli.Context) error {
|
||||
switch ctx.Args().Get(0) {
|
||||
case "generate":
|
||||
configData, err := generateNewConfig()
|
||||
err := writeConfig(generateNewConfig())
|
||||
if err != nil {
|
||||
return iodine.New(err, nil)
|
||||
}
|
||||
return writeConfig(configData)
|
||||
return nil
|
||||
default:
|
||||
configData, err := parseConfigInput(ctx)
|
||||
configStore, err := parseConfigInput(ctx)
|
||||
if err != nil {
|
||||
return iodine.New(err, nil)
|
||||
}
|
||||
return writeConfig(configData)
|
||||
return writeConfig(configStore)
|
||||
}
|
||||
}
|
||||
|
||||
func generateNewConfig() (config *mcConfig, err error) {
|
||||
config = &mcConfig{
|
||||
Version: currentConfigVersion,
|
||||
Hosts: map[string]hostConfig{
|
||||
"http*://s3*.amazonaws.com": {
|
||||
Auth: &auth{
|
||||
AccessKeyID: accessKeyID,
|
||||
SecretAccessKey: secretAccesskey,
|
||||
}},
|
||||
// local minio server can have this empty until webcli is ready
|
||||
// which would make it easier to generate accesskeys and manage them
|
||||
"http*://localhost:*": {
|
||||
Auth: &auth{
|
||||
AccessKeyID: "",
|
||||
SecretAccessKey: "",
|
||||
}},
|
||||
},
|
||||
Aliases: map[string]string{
|
||||
"s3": "https://s3.amazonaws.com",
|
||||
"localhost": "http://localhost:9000",
|
||||
},
|
||||
}
|
||||
return config, nil
|
||||
func generateNewConfig() (config qdb.Store) {
|
||||
configStore := qdb.NewStore(mcCurrentConfigVersion)
|
||||
|
||||
s3Auth := make(map[string]string)
|
||||
localAuth := make(map[string]string)
|
||||
|
||||
hosts := make(map[string]map[string]string)
|
||||
s3Auth["Auth.AccessKeyID"] = accessKeyID
|
||||
s3Auth["Auth.SecretAccessKey"] = secretAccesskey
|
||||
hosts["http*://s3*.amazonaws.com"] = s3Auth
|
||||
|
||||
// local minio server can have this empty until webcli is ready
|
||||
// which would make it easier to generate accesskeys and manage
|
||||
localAuth["Auth.AccessKeyID"] = ""
|
||||
localAuth["Auth.SecretAccessKey"] = ""
|
||||
hosts["http*://localhost:*"] = localAuth
|
||||
|
||||
configStore.SetMapMapString("Hosts", hosts)
|
||||
|
||||
aliases := make(map[string]string)
|
||||
aliases["s3"] = "https://s3.amazonaws.com"
|
||||
aliases["localhost"] = "http://localhost:9000"
|
||||
|
||||
configStore.SetMapString("Aliases", aliases)
|
||||
return configStore
|
||||
}
|
||||
|
||||
func parseConfigInput(ctx *cli.Context) (config *mcConfig, err error) {
|
||||
func parseConfigInput(ctx *cli.Context) (config qdb.Store, err error) {
|
||||
configStore := qdb.NewStore(mcCurrentConfigVersion)
|
||||
configStore.Load(mcConfigFile)
|
||||
|
||||
alias := strings.Fields(ctx.String("alias"))
|
||||
switch true {
|
||||
case len(alias) == 2:
|
||||
@@ -282,22 +197,10 @@ func parseConfigInput(ctx *cli.Context) (config *mcConfig, err error) {
|
||||
if !strings.HasPrefix(url, "http") {
|
||||
return nil, iodine.New(errInvalidURL{url: url}, nil)
|
||||
}
|
||||
config = &mcConfig{
|
||||
Version: currentConfigVersion,
|
||||
Hosts: map[string]hostConfig{
|
||||
"http*://s3*.amazonaws.com": {
|
||||
Auth: &auth{
|
||||
AccessKeyID: accessKeyID,
|
||||
SecretAccessKey: secretAccesskey,
|
||||
}},
|
||||
},
|
||||
Aliases: map[string]string{
|
||||
"s3": "https://s3.amazonaws.com",
|
||||
"localhost": "http://localhost:9000",
|
||||
aliasName: url,
|
||||
},
|
||||
}
|
||||
return config, nil
|
||||
aliases := configStore.GetMapString("Aliases")
|
||||
aliases[aliasName] = url
|
||||
configStore.SetMapString("Aliases", aliases)
|
||||
return configStore, nil
|
||||
default:
|
||||
return nil, iodine.New(errInvalidArgument{}, nil)
|
||||
}
|
||||
@@ -309,22 +212,22 @@ func getHostURL(u *url.URL) string {
|
||||
}
|
||||
|
||||
// getHostConfig retrieves host specific configuration such as access keys, certs.
|
||||
func getHostConfig(requestURL string) (*hostConfig, error) {
|
||||
func getHostConfig(requestURL string) (map[string]string, error) {
|
||||
u, err := url.Parse(requestURL)
|
||||
if err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
return nil, iodine.New(errInvalidURL{url: requestURL}, nil)
|
||||
}
|
||||
config, err := getMcConfig()
|
||||
if err != nil {
|
||||
return nil, iodine.New(err, nil)
|
||||
}
|
||||
for globURL, cfg := range config.Hosts {
|
||||
for globURL, hostConfig := range config.GetMapMapString("Hosts") {
|
||||
match, err := filepath.Match(globURL, getHostURL(u))
|
||||
if err != nil {
|
||||
return nil, iodine.New(errInvalidGlobURL{glob: globURL, request: requestURL}, nil)
|
||||
}
|
||||
if match {
|
||||
return &cfg, nil
|
||||
return hostConfig, nil
|
||||
}
|
||||
}
|
||||
return nil, iodine.New(errNoMatchingHost{}, nil)
|
||||
@@ -336,22 +239,20 @@ func saveConfigCmd(ctx *cli.Context) {
|
||||
if len(ctx.Args()) < 1 && !ctx.IsSet("completion") && !ctx.IsSet("alias") {
|
||||
cli.ShowCommandHelpAndExit(ctx, "config", 1) // last argument is exit code
|
||||
}
|
||||
err := saveConfig(ctx)
|
||||
if os.IsExist(iodine.ToError(err)) {
|
||||
log.Debug.Println(iodine.New(err, nil))
|
||||
configPath, _ := getMcConfigPath()
|
||||
console.Fatalln("mc: Configuration file " + configPath + " already exists")
|
||||
}
|
||||
if err != nil {
|
||||
log.Debug.Println(iodine.New(err, nil))
|
||||
configPath, _ := getMcConfigPath()
|
||||
console.Fatalln("mc: Unable to generate config file", configPath)
|
||||
}
|
||||
configPath, err := getMcConfigPath()
|
||||
if err != nil {
|
||||
log.Debug.Println(iodine.New(err, nil))
|
||||
console.Fatalln("mc: Unable to identify config file path")
|
||||
}
|
||||
err = saveConfig(ctx)
|
||||
if os.IsExist(iodine.ToError(err)) {
|
||||
log.Debug.Println(iodine.New(err, nil))
|
||||
console.Fatalln("mc: Configuration file " + configPath + " already exists")
|
||||
}
|
||||
if err != nil {
|
||||
log.Debug.Println(iodine.New(err, nil))
|
||||
console.Fatalln("mc: Unable to generate config file", configPath)
|
||||
}
|
||||
console.Infoln("mc: Configuration written to " + configPath + ". Please update your access credentials.")
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -18,6 +18,7 @@ package main
|
||||
|
||||
import (
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/cheggaaa/pb"
|
||||
"github.com/minio-io/mc/pkg/client"
|
||||
@@ -105,8 +106,7 @@ func doCopyCmdRecursive(manager clientManager, sourceURL string, targetURLs []st
|
||||
// Construct full target URL path based on source object name
|
||||
var newTargetURLs []string
|
||||
for _, targetURL := range targetURLs {
|
||||
targetURL := targetURL + sourceObject.Key
|
||||
// TODO: strip trailing slashes and properly append
|
||||
targetURL := strings.TrimSuffix(targetURL, "/") + "/" + sourceObject.Key
|
||||
newTargetURLs = append(newTargetURLs, targetURL)
|
||||
}
|
||||
writeClosers, err := getRecursiveTargetWriters(manager, newTargetURLs, md5hex, length)
|
||||
|
||||
@@ -32,14 +32,14 @@ func runCopyCmd(ctx *cli.Context) {
|
||||
cli.ShowCommandHelpAndExit(ctx, "cp", 1) // last argument is exit code
|
||||
}
|
||||
|
||||
config, err := loadMcConfig()
|
||||
config, err := getMcConfig()
|
||||
if err != nil {
|
||||
log.Debug.Println(iodine.New(err, nil))
|
||||
console.Fatalln("mc: Unable to load config file")
|
||||
}
|
||||
|
||||
// Convert arguments to URLs: expand alias, fix format...
|
||||
urls, err := parseURLs(ctx.Args(), config.Aliases)
|
||||
urls, err := parseURLs(ctx.Args(), config.GetMapString("Aliases"))
|
||||
if err != nil {
|
||||
log.Debug.Println(iodine.New(err, nil))
|
||||
console.Fatalln("mc: Unable to parse URL")
|
||||
|
||||
@@ -66,7 +66,7 @@ func doListCmd(ctx *cli.Context) {
|
||||
console.Fatalln("mc: Unable to get config")
|
||||
}
|
||||
for _, arg := range ctx.Args() {
|
||||
u, err := parseURL(arg, config.Aliases)
|
||||
u, err := parseURL(arg, config.GetMapString("Aliases"))
|
||||
if err != nil {
|
||||
log.Debug.Println(iodine.New(err, nil))
|
||||
console.Fatalln("mc: Unable to parse URL")
|
||||
@@ -75,7 +75,7 @@ func doListCmd(ctx *cli.Context) {
|
||||
clnt, err := manager.getNewClient(u, globalDebugFlag)
|
||||
if err != nil {
|
||||
log.Debug.Println(iodine.New(err, nil))
|
||||
console.Fatalln("mc: Unable to initiate new client")
|
||||
console.Fatalln("mc: Unable to instantiate a new client")
|
||||
}
|
||||
|
||||
bucket, object, err := url2Object(u)
|
||||
|
||||
@@ -35,7 +35,7 @@ func doMakeBucketCmd(ctx *cli.Context) {
|
||||
console.Fatalln("mc: Unable to read config")
|
||||
}
|
||||
for _, arg := range ctx.Args() {
|
||||
u, err := parseURL(arg, config.Aliases)
|
||||
u, err := parseURL(arg, config.GetMapString("Aliases"))
|
||||
if err != nil {
|
||||
log.Debug.Println(iodine.New(err, nil))
|
||||
console.Fatalf("mc: Unable to parse URL[%s]\n", u)
|
||||
|
||||
@@ -24,12 +24,6 @@ func (e errInvalidArgument) Error() string {
|
||||
return "invalid argument"
|
||||
}
|
||||
|
||||
type errEmptyURL struct{}
|
||||
|
||||
func (e errEmptyURL) Error() string {
|
||||
return "URL is empty"
|
||||
}
|
||||
|
||||
type errUnsupportedScheme struct {
|
||||
scheme urlType
|
||||
}
|
||||
@@ -55,15 +49,6 @@ func (e errInvalidGlobURL) Error() string {
|
||||
return "Error parsing glob'ed URL while comparing " + e.glob + " " + e.request
|
||||
}
|
||||
|
||||
type errInvalidAliasURL struct {
|
||||
url string
|
||||
alias string
|
||||
}
|
||||
|
||||
func (e errInvalidAliasURL) Error() string {
|
||||
return "Unable to parse URL: " + e.url + " for alias: " + e.alias
|
||||
}
|
||||
|
||||
type errInvalidAliasName struct {
|
||||
alias string
|
||||
}
|
||||
@@ -78,15 +63,6 @@ func (e errInvalidAuth) Error() string {
|
||||
return "invalid auth keys"
|
||||
}
|
||||
|
||||
type errUnsupportedVersion struct {
|
||||
new uint
|
||||
old uint
|
||||
}
|
||||
|
||||
func (e errUnsupportedVersion) Error() string {
|
||||
return fmt.Sprintf("Unsupported version [%d]. Current operating version is [%d]", e.new, e.old)
|
||||
}
|
||||
|
||||
type errNoMatchingHost struct{}
|
||||
|
||||
func (e errNoMatchingHost) Error() string {
|
||||
|
||||
@@ -44,18 +44,13 @@ func checkConfig() {
|
||||
return
|
||||
}
|
||||
|
||||
// Ensures config file is sane and cached to _config private variable.
|
||||
config, err := getMcConfig()
|
||||
// Ensures config file is sane
|
||||
_, err = getMcConfig()
|
||||
if err != nil {
|
||||
log.Debug.Println(iodine.New(err, nil))
|
||||
console.Fatalf("mc: Unable to read config file: %s\n", mustGetMcConfigPath())
|
||||
}
|
||||
|
||||
err = checkMcConfig(config)
|
||||
if err != nil {
|
||||
log.Debug.Println(iodine.New(err, nil))
|
||||
console.Fatalf("mc: Error in config file: %s\n", mustGetMcConfigPath())
|
||||
}
|
||||
}
|
||||
|
||||
// Tries to get os/arch/platform specific information
|
||||
|
||||
+2
-2
@@ -69,7 +69,7 @@ type retryOp struct {
|
||||
|
||||
// instantiate new sequence of retries for the given waittime.
|
||||
func (s waitTime) init() *retryOp {
|
||||
console.Error("trying... ")
|
||||
console.Error("Retrying... ")
|
||||
now := time.Now()
|
||||
return &retryOp{
|
||||
waittime: s,
|
||||
@@ -78,7 +78,7 @@ func (s waitTime) init() *retryOp {
|
||||
}
|
||||
}
|
||||
|
||||
// try()
|
||||
// retry()
|
||||
func (a *retryOp) retry() bool {
|
||||
// grab current time
|
||||
now := time.Now()
|
||||
Reference in New Issue
Block a user