Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A couple random fixes for installer and service startup scripts #453

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion client/pdo/client/builder/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

# -----------------------------------------------------------------
# -----------------------------------------------------------------
Expand All @@ -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()
Expand Down
11 changes: 9 additions & 2 deletions eservice/pdo/eservice/scripts/EServiceCLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '+')

Expand Down Expand Up @@ -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 :
Expand Down Expand Up @@ -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
Expand All @@ -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 :
Expand Down
9 changes: 8 additions & 1 deletion pservice/pdo/pservice/scripts/PServiceCLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '+')

Expand All @@ -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 :
Expand Down Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions sservice/pdo/sservice/scripts/SServiceCLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '+')

Expand Down Expand Up @@ -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 :
Expand Down Expand Up @@ -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 :
Expand All @@ -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 :
Expand Down
Loading