Skip to content

Commit

Permalink
CR fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
liorblob committed Apr 25, 2019
1 parent 02e35ed commit aafce4a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
36 changes: 22 additions & 14 deletions Integrations/SymantecManagementCenter/SymantecManagementCenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def http_request(method, path, params=None, data=None):
except (requests.exceptions.ConnectionError, requests.exceptions.Timeout,
requests.exceptions.TooManyRedirects, requests.exceptions.RequestException):
# TODO: Wait for fiedler
return_error('Connection error')
return_error('Connection to Symantec MC failed. Check the connectivity or try'
' ticking the Trust any certificate check box.')

if res.status_code < 200 or res.status_code > 300:
status = res.status_code
Expand All @@ -67,7 +68,8 @@ def http_request(method, path, params=None, data=None):
details = error_json.get('message')
except Exception:
pass
return_error('Error in API call to Symantec MC, status code: {}, reason: {}, details: {}'.format(status, message, details))
return_error('Error in API call to Symantec MC, status code: {}, reason: {}, details: {}'
.format(status, message, details))

try:
return res.json()
Expand Down Expand Up @@ -116,12 +118,14 @@ def list_devices_command():
'Host': device.get('host'),
'Type': device.get('type')
})

headers = ['UUID', 'Name', 'LastChanged', 'Host', 'Type']
human_readable = tableToMarkdown('Symantec Management Center Devices', contents,
removeNull=True, headers=headers, headerTransform=pascalToSpace)
context['SymantecMC.Device(val.UUID && val.UUID === obj.UUID)'] = createContext(contents, removeNull=True)
else:
human_readable = 'No devices found'

headers = ['UUID', 'Name', 'LastChanged', 'Host', 'Type']
return_outputs(tableToMarkdown('Symantec Management Center Devices', contents,
removeNull=True, headers=headers, headerTransform=pascalToSpace), context, devices)
return_outputs(human_readable, context, devices)


def list_devices_request(build, description, model, name, os_version, platform, device_type):
Expand Down Expand Up @@ -401,12 +405,14 @@ def list_policies_command():
'Tenant': policy.get('tenant'),
'ReplaceVariables': policy.get('replaceVariables')
})

headers = ['UUID', 'Name', 'ContentType', 'Author', 'Shared', 'ReferenceID', 'Tenant', 'ReplaceVariables']
human_readable = tableToMarkdown('Symantec Management Center Policies', contents,
removeNull=True, headers=headers, headerTransform=pascalToSpace)
context['SymantecMC.Policy(val.UUID && val.UUID === obj.UUID)'] = createContext(contents, removeNull=True)
else:
human_readable = 'No policies found'

headers = ['UUID', 'Name', 'ContentType', 'Author', 'Shared', 'ReferenceID', 'Tenant', 'ReplaceVariables']
return_outputs(tableToMarkdown('Symantec Management Center Policies', contents,
removeNull=True, headers=headers, headerTransform=pascalToSpace), context, policies)
return_outputs(human_readable, context, policies)


def list_policies_request(content_type, description, name, reference_id, shared, tenant):
Expand Down Expand Up @@ -906,12 +912,14 @@ def list_tenants_command():
'Description': tenant.get('description'),
'System': tenant.get('system')
})

headers = ['UUID', 'Name', 'ExternalID', 'Description', 'System']
human_readable = tableToMarkdown('Symantec Management Center Tenants', contents,
removeNull=True, headers=headers, headerTransform=pascalToSpace)
context['SymantecMC.Tenant(val.UUID && val.UUID === obj.UUID)'] = createContext(contents, removeNull=True)
else:
human_readable = 'No tenants found'

headers = ['UUID', 'Name', 'ExternalID', 'Description', 'System']
return_outputs(tableToMarkdown('Symantec Management Center Tenants', contents,
removeNull=True, headers=headers, headerTransform=pascalToSpace), context, tenants)
return_outputs(human_readable, context, tenants)


def list_tenants_request():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ configuration:
required: true
type: 0
- defaultvalue: 'true'
display: Trust any certificate (insecure)
display: Trust any certificate (not secure)
name: insecure
required: false
type: 8
Expand Down

0 comments on commit aafce4a

Please sign in to comment.