Skip to content

Commit b37f4f5

Browse files
committed
PTK updates to fix label length issues
1 parent fb154fe commit b37f4f5

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

onefuse/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
Enables the execution of OneFuse policies via Python
55
"""
66

7-
__version__ = "1.4.1"
7+
__version__ = "1.4.2"
88
__credits__ = 'Cloudbolt Software, Inc.'

onefuse/cloudbolt_admin.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,21 @@ def check_or_create_cf(self, cf_name: str, cf_type: str = "STR"):
272272
try:
273273
CustomField.objects.get(name=cf_name)
274274
except:
275+
label = cf_name
276+
if len(label) > 50:
277+
label = label[0:50]
278+
self.logger.warning(f'The label for field {cf_name} had to be '
279+
f'truncated to 50 Characters. New label: '
280+
f'{label}')
281+
if len(cf_name) > 255:
282+
raise OneFuseError(f'CloudBolt is limited to 255 characters '
283+
f'for the name of a parameter. The field: '
284+
f'{cf_name} exceeds this length and must be'
285+
f' shortened before it will work')
275286
self.logger.debug(f'Creating parameter: {cf_name}')
276287
cf = CustomField(
277288
name=cf_name,
278-
label=cf_name,
289+
label=label,
279290
type=cf_type,
280291
show_on_servers=True,
281292
description="Created by the OneFuse plugin for CloudBolt"

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name='onefuse',
8-
version='1.4.1',
8+
version='1.4.2',
99
author='Cloudbolt Software, Inc.',
1010
author_email='[email protected]',
1111
description='OneFuse upstream provider package for Python',

0 commit comments

Comments
 (0)