Skip to content

Commit

Permalink
Merge pull request #16 from cloudblue/bugfix-templates-capabilities
Browse files Browse the repository at this point in the history
BugFix
  • Loading branch information
marcserrat authored Dec 15, 2020
2 parents 4369b3c + 54c9d3f commit 7a44cc3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
10 changes: 5 additions & 5 deletions cnctcli/actions/products/clone_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ def inject(self):
synchronizer.open(input_file, 'Templates')
synchronizer.sync()

try:
for template in sample_templates:
for template in sample_templates:
try:
client.products[product_id].templates[template].delete()
except ClientError:
# done intentionally till fulfillment in progress template not on public api
pass
except ClientError:
# done intentionally till fulfillment in progress template not on public api
pass

clickecho('\n')
synchronizer = ParamsSynchronizer(
Expand Down
20 changes: 11 additions & 9 deletions cnctcli/actions/products/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,9 @@ def _fill_template_row(ws, row_idx, template):
horizontal='left',
vertical='top',
)
ws.cell(row_idx, 5, value=template['type']).alignment = Alignment(
ws.cell(
row_idx, 5, value=template['type'] if 'type' in template else 'fulfillment'
).alignment = Alignment(
horizontal='left',
vertical='top',
)
Expand Down Expand Up @@ -626,13 +628,13 @@ def _dump_capabilities(ws, product, silent):
ws['A3'].value = 'Pay-as-you-go dynamic items support'
ws['B3'].value = '-'
ws['C3'].value = (
ppu['dynamic'] if ppu and 'dynamic' in ppu else 'Disabled'
'Enabled' if ppu and 'dynamic' in ppu and ppu['dynamic'] else 'Disabled'
)
disabled_enabled.add(ws['C3'])
ws['A4'].value = 'Pay-as-you-go future charges support'
ws['B4'].value = '-'
ws['C4'].value = (
ppu['future'] if ppu and 'future' in ppu else 'Disabled'
'Enabled' if ppu and 'future' in ppu and ppu['future'] else 'Disabled'
)
disabled_enabled.add(ws['C4'])
ws['A5'].value = 'Consumption reporting for Reservation Items'
Expand Down Expand Up @@ -735,12 +737,12 @@ def _dump_templates(ws, client, product_id, silent):
for template in templates:
progress.set_description(f'Processing template {template["id"]}')
progress.update(1)
if 'type' in template:
_fill_template_row(ws, row_idx, template)
action_validation.add(f'C{row_idx}')
scope_validation.add(f'D{row_idx}')
type_validation.add(f'E{row_idx}')
row_idx += 1

_fill_template_row(ws, row_idx, template)
action_validation.add(f'C{row_idx}')
scope_validation.add(f'D{row_idx}')
type_validation.add(f'E{row_idx}')
row_idx += 1

progress.close()
print()
Expand Down
5 changes: 3 additions & 2 deletions cnctcli/actions/products/templates_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ def sync(self):
continue
template_data = {
'name': data.title,
'title': data.title,
'scope': data.scope,
'body': data.content,
'type': data.type,
'body': data.content
}
if data.scope == 'asset':
template_data['title'] = data.title
if data.action == 'create':
row_indexes.set_description(f"Creating template {data[1]}")
try:
Expand Down
Binary file modified tests/fixtures/comparation_product.xlsx
Binary file not shown.

0 comments on commit 7a44cc3

Please sign in to comment.