Skip to content

Commit

Permalink
Merge pull request #1311 from CeltonMcGrath/4.7
Browse files Browse the repository at this point in the history
Updated RPM spec file and service file
  • Loading branch information
remkonoteboom committed Dec 12, 2019
2 parents 84b8332 + 0dc6c26 commit 5ca7b28
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 46 deletions.
41 changes: 29 additions & 12 deletions src/install/rpm/tactic-4.7.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

Expand Down Expand Up @@ -59,7 +59,6 @@ case "$1" in
esac



%prep
echo "Prepare TACTIC"
rm -rf $RPM_BUILD_DIR/tactic-4.7
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/install/service/tactic_python3
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 30 additions & 6 deletions src/pyasm/command/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
30 changes: 30 additions & 0 deletions src/pyasm/common/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)



Expand All @@ -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)
Expand Down
14 changes: 4 additions & 10 deletions src/pyasm/search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)


Expand Down Expand Up @@ -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)

Expand Down
8 changes: 1 addition & 7 deletions src/pyasm/search/transaction_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions src/pyasm/widget/table_element_wdg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
9 changes: 1 addition & 8 deletions src/tactic/command/run_transaction_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5ca7b28

Please sign in to comment.