Skip to content

Commit 9043272

Browse files
committed
adapt projadm to the current ConfigMerge usage
1 parent 6fb5eee commit 9043272

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

tools/src/main/python/opengrok_tools/projadm.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# CDDL HEADER END
1919

2020
#
21-
# Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
21+
# Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
2222
#
2323

2424
"""
@@ -54,7 +54,7 @@
5454
print("Need Python 3, you are running {}".format(MAJOR_VERSION))
5555
sys.exit(1)
5656

57-
__version__ = "0.5"
57+
__version__ = "0.6"
5858

5959

6060
def exec_command(doit, logger, cmd, msg):
@@ -148,20 +148,18 @@ def config_refresh(doit, logger, basedir, uri, configmerge, jar_file,
148148
else:
149149
logger.info('Refreshing configuration '
150150
'(merging with read-only config)')
151-
configmerge_cmd = configmerge
152-
configmerge_cmd.extend(['-a', jar_file, roconfig, fcur.name])
153-
if java:
154-
configmerge_cmd.append('-j')
155-
configmerge_cmd.append(java)
156-
merged_config = exec_command(doit, logger,
157-
configmerge_cmd,
158-
"cannot merge configuration")
159151
with tempfile.NamedTemporaryFile() as fmerged:
160152
logger.debug("Temporary file for merged config: {}".
161153
format(fmerged.name))
154+
configmerge_cmd = configmerge
155+
configmerge_cmd.extend(['-a', jar_file, roconfig, fcur.name, fmerged.name])
156+
if java:
157+
configmerge_cmd.append('-j')
158+
configmerge_cmd.append(java)
159+
exec_command(doit, logger,
160+
configmerge_cmd,
161+
"cannot merge configuration")
162162
if doit:
163-
fmerged.write(bytearray(''.join(merged_config), "UTF-8"))
164-
fmerged.flush()
165163
install_config(doit, logger, fmerged.name, main_config)
166164

167165

@@ -251,7 +249,7 @@ def main():
251249
parser.add_argument('-U', '--uri', default='http://localhost:8080/source',
252250
help='URI of the webapp with context path')
253251
parser.add_argument('-c', '--configmerge',
254-
help='path to the ConfigMerge binary')
252+
help='path to the ConfigMerge program')
255253
parser.add_argument('--java', help='Path to java binary '
256254
'(needed for config merge program)')
257255
parser.add_argument('-j', '--jar', help='Path to jar archive to run')
@@ -315,7 +313,7 @@ def main():
315313

316314
# If read-only configuration file is specified, this means read-only
317315
# configuration will need to be merged with active webapp configuration.
318-
# This requires config merge tool to be run so couple of other things
316+
# This requires config merge tool to be run so a couple of other things
319317
# need to be checked.
320318
if args.roconfig:
321319
if path.isfile(args.roconfig):

0 commit comments

Comments
 (0)