Skip to content

Commit

Permalink
CommonServerUserPython upload bug (#2352)
Browse files Browse the repository at this point in the history
* edit

* edit

* Update CHANGELOG.md

Co-authored-by: Shai Yaakovi <[email protected]>

* fixed conflict issue

Co-authored-by: Shai Yaakovi <[email protected]>
  • Loading branch information
merit-maita and yaakovi authored Sep 18, 2022
1 parent 4223a8a commit 0b16f1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Changelog
* Fixed an issue where the **upload** command did not work with the CommonServerUserPython package.

## Unreleased
* Added playbook modification capabilities in **TestSuite**.
Expand Down
12 changes: 8 additions & 4 deletions demisto_sdk/commands/unify/integration_script_unifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,19 @@ def get_code_file(self, script_type):
self.package_path = self.package_path[:-1] # remove the last / as we use os.path.join
if self.package_path.endswith(os.path.join('Scripts', 'CommonServerPython')):
return os.path.join(self.package_path, 'CommonServerPython.py')
if self.package_path.endswith(os.path.join('Scripts', 'CommonServerUserPython')):
return os.path.join(self.package_path, 'CommonServerUserPython.py')
if self.package_path.endswith(os.path.join('Scripts', 'CommonServerPowerShell')):
return os.path.join(self.package_path, 'CommonServerPowerShell.ps1')
if self.package_path.endswith('ApiModule'):
return os.path.join(self.package_path, os.path.basename(os.path.normpath(self.package_path)) + '.py')

script_path = list(filter(lambda x: not re.search(ignore_regex, x, flags=re.IGNORECASE),
sorted(glob.glob(os.path.join(self.package_path, '*' + script_type)))))[0]

return script_path
script_path_list = list(filter(lambda x: not re.search(ignore_regex, x, flags=re.IGNORECASE),
sorted(glob.glob(os.path.join(self.package_path, '*' + script_type)))))
if script_path_list:
return script_path_list[0]
else:
raise Exception("the provided code file is not supported")

def insert_script_to_yml(self, script_type, yml_unified, yml_data):
script_path = self.get_code_file(script_type)
Expand Down

0 comments on commit 0b16f1f

Please sign in to comment.