Exemple #1
0
def main(argv):

    parser = argparse.ArgumentParser()
    parser.add_argument("-r","--reader",        help="verify reader access ", action="store_true")
    parser.add_argument("-t","--contributor",   help="verify contributor access ", action="store_true")

    path    = None

    args     = parser.parse_args()
    if args.path != None:
       path = args.path


    try:
       myConfig = vmx.Config(path)
       myConfig.LoadConfig()
    except:
       raise Exception("Site Configuration Not Specified")

    if args.reader == True:
       try:
           vreader = vtc.ReaderVerify(path)
       except:
           print ("Reader access verification fails")
           sys.exit

       try:
           if vreader.Verify() == False :
              sys.exit
           print("Reader Verification Succeeded")
def main(argv):

    parser = argparse.ArgumentParser()
    parser.add_argument("-p","--path",    help="configuration path")
    parser.add_argument("-t","--tools",   help="access Veriteem javascript tools ", action="store_true")


    path    = None

    args     = parser.parse_args()
    if args.path != None:
       path = args.path


    try:
       myConfig = vmx.Config(path)
       myConfig.LoadConfig()
    except:
       raise Exception("Site Configuration Not Specified")

    try:
       ledgerPath = myConfig.find_module_path("veriteemcomplianceledger")
       scriptPath = os.path.join(ledgerPath, "scripts")
       os.chdir(scriptPath)
    except:
       ErrMsg = "Cannot locate tools in " + scriptPath
       raise Exception(ErrMsg)
           
    gethExe = myConfig.getChainExe()
    Cmd = gethExe + " --preload LoadZigBee.js attach ipc:" + myConfig.GETHDATA + "/geth.ipc --datadir " + myConfig.GETHDATA
    os.system(Cmd)
    def __init__(self, path):

        installerror = "There is an error with the installation.  Please reinstall with the following commands\n  pip3 install veriteemcomplianceledger\n  VeriteemConfig.py -r "

        try:
            self.myConfig = veriteem.Config(None)
        except:
            Ex = ValueError()
            Ex.strerror = installerror
            raise Ex

        try:
            self.myConfig.LoadConfig()
        except:
            Ex = ValueError()
            Ex.strerror = installerror
            raise Ex
Exemple #4
0
def main(argv):

    parser = argparse.ArgumentParser()
    parser.add_argument("-c",
                        "--config",
                        help="configure parameters",
                        action="store_true")
    parser.add_argument("-i",
                        "--init",
                        help="initialize blockchain",
                        action="store_true")
    parser.add_argument("-r",
                        "--run",
                        help="start the veriteem service ",
                        action="store_true")
    parser.add_argument("-m",
                        "--miner",
                        help="start the veriteem mining service ",
                        action="store_true")
    parser.add_argument("-s",
                        "--stop",
                        help="stop the chain miner",
                        action="store_true")
    parser.add_argument("-a",
                        "--access",
                        help="add account to access control",
                        action="store_true")
    parser.add_argument("-t",
                        "--total",
                        help="configure, init, and start the chain miner",
                        action="store_true")
    parser.add_argument("-p", "--path", help="configuration path")
    parser.add_argument("-n",
                        "--nosave",
                        help="do not save path",
                        action="store_true")

    path = None

    args = parser.parse_args()

    #
    #  Check on the installation to see if we need to install assets/programs
    #
    myInstall = vmx.VeriteemInstall()
    myInstall.CheckInstallation()

    #
    # If we do not a complete config, turn on the config option
    #
    myConfig = vmx.Config(path)
    if myConfig.IsComplete() == False:
        args.config = True

    # if no arguments were provided, default to --total
    if len(argv) == 1:
        args.total = True

    if args.path != None:
        path = args.path

    # if the user wants to run all items or the config option
    if (args.config == True) or (args.total == True):
        try:
            myConfig = vmx.Configure(path, args.nosave)
        except Exception as ex:
            # print(traceback.format_exc())
            print(ex)
            return
        myConfig.Create()

    # if the user wants to run all items or create the blockchain
    if (args.init == True) or (args.total == True):
        try:
            myInit = vmx.InitGeth(path)
        except:
            print(traceback.format_exc())
            return
        myInit.CreateBlockChain()

    # if the user wants to run all items or start the veriteem service
    if (args.run == True) or (args.total == True):
        try:
            myVeriteem = vmx.StartVeriteem(path)
        except:
            print(traceback.format_exc())
            return
        myVeriteem.Start()

    # if the user wants to start the miner
    if (args.miner == True):
        try:
            myMiner = vmx.StartMiner(path)
        except:
            print(traceback.format_exc())
            return
        myMiner.Start()

    if (args.access == True):
        try:
            myAccess = vmx.AccessControl(path)
        except:
            print(traceback.format_exc())
            return
        myAccess.AddAccess()

    if args.total == True:
        readMe = myConfig.myConfig.getPackageFile("veriteem", None,
                                                  "README.md")
        fd = open(readMe, "r")
        readMeStr = fd.read()
        print(readMeStr)

    if args.stop == True:
        Cmd = "killall veriteem"
        os.system(Cmd)