Fix last createDir.
This commit is contained in:
parent
86139839f1
commit
82228fe471
|
@ -1262,8 +1262,15 @@ programMain:
|
||||||
swap(mnemonic, walletRes.get.mnemonic)
|
swap(mnemonic, walletRes.get.mnemonic)
|
||||||
walletPath = walletRes.get.walletPath
|
walletPath = walletRes.get.walletPath
|
||||||
|
|
||||||
createDir(config.outValidatorsDir)
|
let vres = createPath(config.outValidatorsDir, 0o750)
|
||||||
createDir(config.outSecretsDir)
|
if vres.isErr():
|
||||||
|
fatal "Could not create directory", path = config.outValidatorsDir
|
||||||
|
quit QuitFailure
|
||||||
|
|
||||||
|
let sres = createPath(config.outSecretsDir, 0o750)
|
||||||
|
if sres.isErr():
|
||||||
|
fatal "Could not create directory", path = config.outSecretsDir
|
||||||
|
quit QuitFailure
|
||||||
|
|
||||||
let deposits = generateDeposits(
|
let deposits = generateDeposits(
|
||||||
config.runtimePreset,
|
config.runtimePreset,
|
||||||
|
|
|
@ -5,7 +5,8 @@ import
|
||||||
chronicles, chronicles/options as chroniclesOptions,
|
chronicles, chronicles/options as chroniclesOptions,
|
||||||
confutils, confutils/defs, confutils/std/net, stew/shims/net as stewNet,
|
confutils, confutils/defs, confutils/std/net, stew/shims/net as stewNet,
|
||||||
json_serialization, web3/[ethtypes, confutils_defs],
|
json_serialization, web3/[ethtypes, confutils_defs],
|
||||||
spec/[crypto, keystore, digest, datatypes, network], network_metadata
|
spec/[crypto, keystore, digest, datatypes, network], network_metadata,
|
||||||
|
stew/io2
|
||||||
|
|
||||||
export
|
export
|
||||||
defaultEth2TcpPort, enabledLogLevel, ValidIpAddress,
|
defaultEth2TcpPort, enabledLogLevel, ValidIpAddress,
|
||||||
|
@ -440,13 +441,15 @@ func dumpDirOutgoing*(conf: BeaconNodeConf|ValidatorClientConf): string =
|
||||||
|
|
||||||
proc createDumpDirs*(conf: BeaconNodeConf) =
|
proc createDumpDirs*(conf: BeaconNodeConf) =
|
||||||
if conf.dumpEnabled:
|
if conf.dumpEnabled:
|
||||||
try:
|
let resInv = createPath(conf.dumpDirInvalid, 0o750)
|
||||||
createDir(conf.dumpDirInvalid)
|
if resInv.isErr():
|
||||||
createDir(conf.dumpDirIncoming)
|
warn "Could not create dump directory", path = conf.dumpDirInvalid
|
||||||
createDir(conf.dumpDirOutgoing)
|
let resInc = createPath(conf.dumpDirIncoming, 0o750)
|
||||||
except CatchableError as err:
|
if resInc.isErr():
|
||||||
# Dumping is mainly a debugging feature, so ignore these..
|
warn "Could not create dump directory", path = conf.dumpDirIncoming
|
||||||
warn "Cannot create dump directories", msg = err.msg
|
let resOut = createPath(conf.dumpDirOutgoing, 0o750)
|
||||||
|
if resOut.isErr():
|
||||||
|
warn "Could not create dump directory", path = conf.dumpDirOutgoing
|
||||||
|
|
||||||
func parseCmdArg*(T: type GraffitiBytes, input: TaintedString): T
|
func parseCmdArg*(T: type GraffitiBytes, input: TaintedString): T
|
||||||
{.raises: [ValueError, Defect].} =
|
{.raises: [ValueError, Defect].} =
|
||||||
|
|
|
@ -2,7 +2,7 @@ import
|
||||||
os, sequtils, strutils, options, json, terminal, random,
|
os, sequtils, strutils, options, json, terminal, random,
|
||||||
chronos, chronicles, confutils, stint, json_serialization,
|
chronos, chronicles, confutils, stint, json_serialization,
|
||||||
../beacon_chain/network_metadata,
|
../beacon_chain/network_metadata,
|
||||||
web3, web3/confutils_defs, eth/keys,
|
web3, web3/confutils_defs, eth/keys, stew/io2,
|
||||||
spec/[datatypes, crypto, presets], ssz/merkleization, keystore_management
|
spec/[datatypes, crypto, presets], ssz/merkleization, keystore_management
|
||||||
|
|
||||||
# Compiled version of /scripts/depositContract.v.py in this repo
|
# Compiled version of /scripts/depositContract.v.py in this repo
|
||||||
|
@ -178,8 +178,15 @@ proc main() {.async.} =
|
||||||
mnemonic = generateMnemonic(rng[])
|
mnemonic = generateMnemonic(rng[])
|
||||||
runtimePreset = getRuntimePresetForNetwork(cfg.eth2Network)
|
runtimePreset = getRuntimePresetForNetwork(cfg.eth2Network)
|
||||||
|
|
||||||
createDir(string cfg.outValidatorsDir)
|
let vres = createPath(string cfg.outValidatorsDir, 0o750)
|
||||||
createDir(string cfg.outSecretsDir)
|
if vres.isErr():
|
||||||
|
warn "Could not create validators folder",
|
||||||
|
path = string cfg.outValidatorsDir, err = ioErrorMsg(vres.error)
|
||||||
|
|
||||||
|
let sres = createPath(string cfg.outSecretsDir, 0o750)
|
||||||
|
if sres.isErr():
|
||||||
|
warn "Could not create secrets folder",
|
||||||
|
path = string cfg.outSecretsDir, err = ioErrorMsg(sres.error)
|
||||||
|
|
||||||
let deposits = generateDeposits(
|
let deposits = generateDeposits(
|
||||||
runtimePreset,
|
runtimePreset,
|
||||||
|
|
|
@ -14,6 +14,7 @@ import
|
||||||
# Nimble packages
|
# Nimble packages
|
||||||
chronos, confutils/defs,
|
chronos, confutils/defs,
|
||||||
chronicles, chronicles/helpers as chroniclesHelpers,
|
chronicles, chronicles/helpers as chroniclesHelpers,
|
||||||
|
stew/io2,
|
||||||
|
|
||||||
# Local modules
|
# Local modules
|
||||||
spec/[datatypes, crypto, helpers], eth2_network, time
|
spec/[datatypes, crypto, helpers], eth2_network, time
|
||||||
|
@ -36,10 +37,10 @@ proc setupLogging*(logLevel: string, logFile: Option[OutFile]) =
|
||||||
let
|
let
|
||||||
logFile = logFile.get.string
|
logFile = logFile.get.string
|
||||||
logFileDir = splitFile(logFile).dir
|
logFileDir = splitFile(logFile).dir
|
||||||
try:
|
let lres = createPath(logFileDir, 0o750)
|
||||||
createDir logFileDir
|
if lres.isErr():
|
||||||
except CatchableError as err:
|
error "Failed to create directory for log file",
|
||||||
error "Failed to create directory for log file", path = logFileDir, err = err.msg
|
path = logFileDir, err = ioErrorMsg(lres.error)
|
||||||
break openLogFile
|
break openLogFile
|
||||||
|
|
||||||
if not defaultChroniclesStream.outputs[1].open(logFile):
|
if not defaultChroniclesStream.outputs[1].open(logFile):
|
||||||
|
|
|
@ -35,6 +35,8 @@ declareCounter beacon_blocks_proposed,
|
||||||
|
|
||||||
logScope: topics = "beacval"
|
logScope: topics = "beacval"
|
||||||
|
|
||||||
|
# TODO: This procedure follows insecure scheme of creating directory without
|
||||||
|
# any permissions and writing file without any permissions.
|
||||||
proc saveValidatorKey*(keyName, key: string, conf: BeaconNodeConf) =
|
proc saveValidatorKey*(keyName, key: string, conf: BeaconNodeConf) =
|
||||||
let validatorsDir = conf.validatorsDir
|
let validatorsDir = conf.validatorsDir
|
||||||
let outputFile = validatorsDir / keyName
|
let outputFile = validatorsDir / keyName
|
||||||
|
|
Loading…
Reference in New Issue