diff --git a/client/pdo/client/builder/installer.py b/client/pdo/client/builder/installer.py index 0165dd04..776cbbce 100644 --- a/client/pdo/client/builder/installer.py +++ b/client/pdo/client/builder/installer.py @@ -38,11 +38,12 @@ def _copy_to_destination_(source_path, destination_path) : return dp = pathlib.Path(destination_path) - dp.mkdir(exist_ok=True) + dp.mkdir(parents=True, exist_ok=True) for f in source_path.iterdir() : logger.info('copy plugin resource {} to {}'.format(f.name, destination_path)) dp.joinpath(f.name).write_bytes(f.read_bytes()) + dp.joinpath(f.name).chmod(f.stat().st_mode) # ----------------------------------------------------------------- # ----------------------------------------------------------------- @@ -61,6 +62,7 @@ def install_plugin_resources() : created through the standard configuration modules. destinations can be overridden with the '--bind' arguments. """ + (state, bindings, args) = pshell.parse_shell_command_line(sys.argv[1:]) parser = argparse.ArgumentParser() diff --git a/eservice/pdo/eservice/scripts/EServiceCLI.py b/eservice/pdo/eservice/scripts/EServiceCLI.py index 04538d55..e26d72e4 100644 --- a/eservice/pdo/eservice/scripts/EServiceCLI.py +++ b/eservice/pdo/eservice/scripts/EServiceCLI.py @@ -251,6 +251,8 @@ def Main() : parser = argparse.ArgumentParser() + parser.add_argument('-b', '--bind', help='Define variables for configuration and script use', nargs=2, action='append') + parser.add_argument('--config', help='configuration file', nargs = '+') parser.add_argument('--config-dir', help='directory to search for configuration files', nargs = '+') @@ -280,6 +282,11 @@ def Main() : config_map['identity'] = options.identity + # set up the configuration mapping from the parameters + if options.bind : + for (k, v) in options.bind : config_map[k] = v + + # parse the configuration files try : config = pconfig.parse_configuration_files(conffiles, confpaths, config_map) except pconfig.ConfigurationException as e : @@ -323,7 +330,7 @@ def Main() : config['EnclaveData'] = { 'FileName' : 'enclave.data', 'SavePath' : './data', - 'SearchPath' : [ '.', './data' ] + 'SearchPath' : [ '.', './data', config_map['data'] ] } if options.enclave_data : config['EnclaveData']['FileName'] = options.enclave_data @@ -335,7 +342,7 @@ def Main() : # set up the enclave service configuration if config.get('StorageService') is None : config['StorageService'] = { - 'BlockStore' : os.path.join(ContractData, options.identity + '.mdb'), + 'BlockStore' : os.path.join(config_map['data'], options.identity + '.mdb'), 'URL' : 'http://localhost:7201' } if options.block_store : diff --git a/pservice/pdo/pservice/scripts/PServiceCLI.py b/pservice/pdo/pservice/scripts/PServiceCLI.py index 779b1961..0a1340ba 100644 --- a/pservice/pdo/pservice/scripts/PServiceCLI.py +++ b/pservice/pdo/pservice/scripts/PServiceCLI.py @@ -429,6 +429,8 @@ def Main() : parser = argparse.ArgumentParser() + parser.add_argument('-b', '--bind', help='Define variables for configuration and script use', nargs=2, action='append') + parser.add_argument('--config', help='configuration file', nargs = '+') parser.add_argument('--config-dir', help='directory to search for configuration files', nargs = '+') @@ -455,6 +457,11 @@ def Main() : config_map['identity'] = options.identity + # set up the configuration mapping from the parameters + if options.bind : + for (k, v) in options.bind : config_map[k] = v + + # parse the configuration files try : config = pconfig.parse_configuration_files(conffiles, confpaths, config_map) except pconfig.ConfigurationException as e : @@ -505,7 +512,7 @@ def Main() : config['ProvisioningData'] = { 'FileName' : 'provisioning.data', 'SavePath' : './data', - 'SearchPath' : [ '.', './data' ] + 'SearchPath' : [ '.', './data', config_map['data'] ] } if options.provisioning_data : config['ProvisioningData']['FileName'] = options.provisioning_data diff --git a/sservice/pdo/sservice/scripts/SServiceCLI.py b/sservice/pdo/sservice/scripts/SServiceCLI.py index d8e95ea6..5cd5decc 100644 --- a/sservice/pdo/sservice/scripts/SServiceCLI.py +++ b/sservice/pdo/sservice/scripts/SServiceCLI.py @@ -214,6 +214,8 @@ def Main() : parser = argparse.ArgumentParser() + parser.add_argument('-b', '--bind', help='Define variables for configuration and script use', nargs=2, action='append') + parser.add_argument('--config', help='configuration file', nargs = '+') parser.add_argument('--config-dir', help='directory to search for configuration files', nargs = '+') @@ -244,6 +246,11 @@ def Main() : if options.data_dir : config_map['data'] = options.data_dir + # set up the configuration mapping from the parameters + if options.bind : + for (k, v) in options.bind : config_map[k] = v + + # parse the configuration files try : config = pconfig.parse_configuration_files(conffiles, confpaths, config_map) except pconfig.ConfigurationException as e : @@ -271,7 +278,7 @@ def Main() : # set up the key search paths if config.get('Key') is None : config['Key'] = { - 'SearchPath' : ['.', './keys', ContractKeys], + 'SearchPath' : [ '.', './keys', config_map['keys'] ], 'FileName' : options.identity + ".pem" } if options.key_dir : @@ -283,7 +290,7 @@ def Main() : 'HttpPort' : 7201, 'Host' : 'localhost', 'Identity' : options.identity, - 'BlockStore' : os.path.join(ContractData, options.identity + '.mdb'), + 'BlockStore' : os.path.join(config_map['data'], options.identity + '.mdb'), 'GarbageCollectionInterval' : 10 } if options.http :