Printing a debug message and exiting the CLI if the information about the genesis nodes is not found
@@ -246,15 +246,23 @@ class Cli:
self.logger = getlogger("cli")
self.print("\n{}-CLI (c) 2016 Evernym, Inc.".format(self.properName))
+ self._actions = []
+
if nodeReg:
self.print("Node registry loaded.")
- # self.print("None of these are created or running yet.")
-
self.showNodeRegistry()
- self.print("Type 'help' for more information.")
- self.print("Running {} {}\n".format(self.properName, self.getCliVersion()))
+ else:
+ self.print("No information is found which can be used to connect to"
+ " the Sovrin nodes. This indicates an error. Check if "
+ "the file containing genesis transactions is present "
+ "in your base direcory which can be found in the config "
+ "as `baseDir`, if not then get this file from the github"
+ " repository and paste it in location `baseDir`")
+ sys.exit(1)
- self._actions = []
+ self.print("Type 'help' for more information.")
+ self.print("Running {} {}\n".format(self.properName,
+ self.getCliVersion()))
tp = loadPlugins(self.basedirpath)
self.logger.debug("total plugins loaded in cli: {}".format(tp))
@@ -262,7 +270,8 @@ class Cli:
self.restoreLastActiveWallet("{}*{}".format(WALLET_FILE_NAME_PREFIX,
self.name))
- def getCliVersion(self):
+ @staticmethod
+ def getCliVersion():
return __version__
@property
@@ -288,7 +297,6 @@ class Cli:
self._useKeyringAction]
return self._actions
-
@property
def config(self):
if self._config:
@@ -1477,7 +1485,6 @@ class Cli:
return os.path.expanduser(os.path.join(self.config.baseDir,
self.config.keyringsDir))
-
def isAnyWalletFileExistsForEnv(self, envName):
keyringPath = self.getKeyringsBaseDir()
pattern = "{}/{}*{}{}".format(keyringPath, WALLET_FILE_NAME_PREFIX,
