diff --git a/src/install/rpm/tactic-4.7.spec b/src/install/rpm/tactic-4.7.spec index 4b02f22450..fe236a95de 100755 --- a/src/install/rpm/tactic-4.7.spec +++ b/src/install/rpm/tactic-4.7.spec @@ -3,16 +3,16 @@ %define _topdir /home/tactic/TACTIC-RPM %define name TACTIC %define release 0 -%define version 4.7.0.a11 +%define version 4.7.0.b02 %define buildroot %{_top_dir}/%{name}-%{version}-root %define user tactic +#%define python3_sitelib /usr/lib/python3.7/site-packages # To prevent binary stripping for specific rpm %global __os_install_post %{nil} - BuildRoot: %{buildroot} Summary: Workflow automation development environment TACTIC Vendor: Southpaw Technology Inc. @@ -27,11 +27,11 @@ License: EPL #BuildRequires: Requires: postgresql-server Requires: python3 -Requires: python3-pillow -Requires: python3-pycryptodomex -Requires: python3-lxml -Requires: python3-requests -Requires: python3-pytz +#Requires: python3-pillow +#Requires: python3-pycryptodomex +#Requires: python3-lxml +#Requires: python3-requests +#Requires: python3-pytz Requires: httpd Requires: chkconfig @@ -59,7 +59,6 @@ case "$1" in esac - %prep echo "Prepare TACTIC" rm -rf $RPM_BUILD_DIR/tactic-4.7 @@ -81,7 +80,6 @@ echo "Build Root: $RPM_BUILD_ROOT" mkdir -p "$RPM_BUILD_ROOT/opt/tactic" cp -R -f * "$RPM_BUILD_ROOT/opt/tactic" - install --directory "$RPM_BUILD_ROOT/opt/tactic" install --directory "$RPM_BUILD_ROOT/opt/tactic/tactic_data" @@ -111,8 +109,9 @@ mkdir -p "$RPM_BUILD_ROOT/etc/httpd/conf.d" install -m 644 $RPM_BUILD_DIR/config/apache/tactic.conf $RPM_BUILD_ROOT/etc/httpd/conf.d/ # TACTIC Bootstrap Python Module -mkdir -p "$RPM_BUILD_ROOT/usr/lib/python3.7/site-packages/tacticenv" -install -m 644 $RPM_BUILD_DIR/config/data/* $RPM_BUILD_ROOT/usr/lib/python3.7/site-packages/tacticenv +#mkdir -p "$RPM_BUILD_ROOT/%{python3_sitelib}/tacticenv" +#install -m 644 $RPM_BUILD_DIR/config/data/* $RPM_BUILD_ROOT/%{python3_sitelib}/tacticenv + # TACTIC Service Script mkdir -p "$RPM_BUILD_ROOT/etc/init.d" @@ -125,6 +124,24 @@ if [ "$1" = "1" ]; then chkconfig --level 235 tactic on fi +# Create tacticenv directory in /usr/lib/python3.x/site_packages/ +# and copy tacticenv/* into the newly created directory. +# TODO: we can't cleanly remove this in the uninstall. If we remove this in the %postun section, +# it causes problems during the upgrade. At the moment, /usr/lib/python3.x/site_packages/tacticenv +# needs to be manually removed after uninstalling TACTIC. +PY3_LIB=`/usr/bin/python3 -c 'from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())'` +TACTIC_ENV_DIR="$PY3_LIB/tacticenv" +if [ ! -d "$TACTIC_ENV_DIR" ]; then + echo "Creating $TACTIC_ENV_DIR" + mkdir "$TACTIC_ENV_DIR" +fi +cp /opt/tactic/tactic/src/install/data/* "$PY3_LIB/tacticenv/" + +echo "TACTIC_INSTALL_DIR='/opt/tactic/tactic'" >> "$PY3_LIB/tacticenv/tactic_paths.py" +echo "TACTIC_SITE_DIR=''" >> "$PY3_LIB/tacticenv/tactic_paths.py" +echo "TACTIC_DATA_DIR='/opt/tactic/tactic_data'" >> "$PY3_LIB/tacticenv/tactic_paths.py" +echo "" >> "$PY3_LIB/tacticenv/tactic_paths.py" + echo "For Initial Setup, please execute:" echo echo "python3 src/pyasm/search/upgrade/postgresql/bootstrap_load.py" @@ -146,7 +163,7 @@ echo %dir %attr(0755, %{user}, %{user}) /opt/tactic/tactic_data/templates %dir %attr(0755, %{user}, %{user}) /opt/tactic/tactic_data/dist %dir %attr(0755, %{user}, %{user}) /opt/tactic/assets -/usr/lib/python3.7/site-packages/tacticenv +#%{python3_sitelib}/tacticenv %config diff --git a/src/install/service/tactic_python3 b/src/install/service/tactic_python3 index 02399b3b37..4b9d55e672 100644 --- a/src/install/service/tactic_python3 +++ b/src/install/service/tactic_python3 @@ -9,7 +9,7 @@ # or disclosed in any way without written permission. # -# chkconfig: 2345 85 15 +# chkconfig: 2345 100 15 # description: Startup script for Tactic on UNIX systems. # Repurposed from WebKit diff --git a/src/pyasm/command/workflow.py b/src/pyasm/command/workflow.py index e4243f9d66..67bac83fb0 100755 --- a/src/pyasm/command/workflow.py +++ b/src/pyasm/command/workflow.py @@ -2409,21 +2409,45 @@ def handle_condition_node(self, sobject, pipeline, process, triggers): if isinstance(ret_val, six.string_types): ret_val = [ret_val] + + all_outputs = pipeline.get_output_processes(process) output_processes = [] + output_process_names = [] + not_required_streams = [] + + + """ + Two types of return values: stream (from_attr on connector) + or names of output processes. + - If streams have been returned, use these streams to + find required processes, and set all other output_processes + as not_required. + - If processes have been returned, set these processes as required, + and set all other output_processes as not required. + """ + + # Check for streams for attr in ret_val: outputs = pipeline.get_output_processes(process, from_attr=attr) if outputs: - output_processes.extend(outputs) + for output in outputs: + output_processes.append(output) + output_process_names.append(output.get_name()) + - # if there are no output attrs, then check the node names - if not output_processes: - outputs = pipeline.get_output_processes(process) - for output in outputs: - output_process_name = output.get_name() + if output_processes: + for output in all_outputs: + if output.get_name() not in output_process_names: + not_required_streams.append(output.get_name()) + + + else: + for output in all_outputs: if output.get_name() in ret_val: output_processes.append(output) + output_process_names.append(output.get_name()) else: not_required_streams.append(output.get_name()) diff --git a/src/pyasm/common/common.py b/src/pyasm/common/common.py index 99d4413da5..dd283a0843 100644 --- a/src/pyasm/common/common.py +++ b/src/pyasm/common/common.py @@ -992,6 +992,35 @@ def convert_to_json(data): dict_str = dict_str.replace('"', '"') return dict_str convert_to_json = staticmethod(convert_to_json) + + + + def compress_transaction(transaction_data): + '''Compress and hexify large string.''' + import zlib, binascii + if IS_Pv3: + transaction_data = transaction_data.encode() + else: + transaction_data = Common.process_unicode_string(transaction_data) + + ztransaction_data = binascii.hexlify(zlib.compress(transaction_data)) + if Common.IS_Pv3: + ztransaction_data = ztransaction_data.decode() + + ztransaction_data = "zlib:%s" % ztransaction_data + return ztransaction_data + compress_transaction = staticmethod(compress_transaction) + + + + def decompress_transaction(ztransaction_data): + '''Unhexify and decompress data.''' + import zlib, binascii + value = zlib.decompress(binascii.unhexlify(ztransaction_data[5:])) + if IS_Pv3: + value = value.decode() + return value + decompress_transaction = staticmethod(decompress_transaction) @@ -1001,6 +1030,7 @@ def pretty_print(data): pretty_print = staticmethod(pretty_print) + def get_pretty_print(data): data_str = StringIO.StringIO() pprint.pprint(data, indent=4, stream=data_str) diff --git a/src/pyasm/search/search.py b/src/pyasm/search/search.py index 8119485864..101573a3e6 100755 --- a/src/pyasm/search/search.py +++ b/src/pyasm/search/search.py @@ -3214,8 +3214,7 @@ def get_json_value(self, name, default=None, no_exception=False): return value if value.startswith("zlib:"): - import zlib, binascii - value = zlib.decompress( binascii.unhexlify(value[5:]) ) + value = Common.decompress_transaction(value) if value.strip(): try: @@ -3242,12 +3241,8 @@ def set_json_value(self, name, value): length_before = len(data) cutoff = 10*1024 if length_before > cutoff: - import zlib, binascii - data = Common.process_unicode_string(data) - data = binascii.hexlify(zlib.compress(data)) - data = "zlib:%s" % data - length_after = len(data) - #print("transaction log compress: ", "%s%%" % int(float(length_after)/float(length_before)*100), "[%s] to [%s]" % (length_before, length_after)) + data = Common.compress_transaction(data) + self.set_value(name, data) @@ -3284,8 +3279,7 @@ def get_xml_value(self, name, root=None, strip_cdata=True, remove_blank_text=Tru value = '' if value.startswith("zlib:"): - import zlib, binascii - value = zlib.decompress( binascii.unhexlify(value[5:]) ) + value = Common.decompress_transaction(value) xml = Xml(strip_cdata=strip_cdata) diff --git a/src/pyasm/search/transaction_log.py b/src/pyasm/search/transaction_log.py index dc46bf6ea4..d2d96bada3 100644 --- a/src/pyasm/search/transaction_log.py +++ b/src/pyasm/search/transaction_log.py @@ -147,13 +147,7 @@ def create(cls, command, transaction_data, description, title='', state=None, ke length_before = len(transaction_data) cutoff = 10*1024 if length_before > cutoff: - import zlib, binascii - if IS_Pv3: - transaction_data = transaction_data.encode() - else: - transaction_data = Common.process_unicode_string(transaction_data) - ztransaction_data = binascii.hexlify(zlib.compress(transaction_data)) - ztransaction_data = "zlib:%s" % ztransaction_data + ztransaction_data = Common.compress_transaction(transaction_data) length_after = len(ztransaction_data) print("transaction log compress: ", "%s%%" % int(float(length_after)/float(length_before)*100), "[%s] to [%s]" % (length_before, length_after)) else: diff --git a/src/pyasm/widget/table_element_wdg.py b/src/pyasm/widget/table_element_wdg.py index 0c153200ef..f9dbd65a1a 100755 --- a/src/pyasm/widget/table_element_wdg.py +++ b/src/pyasm/widget/table_element_wdg.py @@ -1149,8 +1149,7 @@ def get_display(self): value = jsondumps(value) elif value.startswith("zlib:"): - import zlib, binascii - value = zlib.decompress( binascii.unhexlify(value[5:]) ) + value = Common.decompress_transaction(value) widget = DivWdg() widget.add_style("min-width: 300px") diff --git a/src/tactic/command/run_transaction_cmd.py b/src/tactic/command/run_transaction_cmd.py index 19024f65b4..d7eb2129a2 100644 --- a/src/tactic/command/run_transaction_cmd.py +++ b/src/tactic/command/run_transaction_cmd.py @@ -357,16 +357,9 @@ def execute(self): job.commit() return - - import zlib, binascii - #transaction_data = Common.process_unicode_string(transaction_xml) transaction_data = transaction_xml.to_string() - if isinstance(transaction_data, unicode): - transaction_data = transaction_data.encode('utf-8') + ztransaction_data = Common.compress_transaction(transaction_data) length_before = len(transaction_data) - compressed = zlib.compress(transaction_data) - ztransaction_data = binascii.hexlify(compressed) - ztransaction_data = "zlib:%s" % ztransaction_data length_after = len(ztransaction_data) print("transaction log recompress: ", "%s%%" % int(float(length_after)/float(length_before)*100), "[%s] to [%s]" % (length_before, length_after)) # reset the transaction log sobject with the new xml. This