Skip to content

Commit

Permalink
Merge pull request #15 from GMaxera/jira/IN-179-fix-task-name-too-long
Browse files Browse the repository at this point in the history
IN-179 Fix task name too long when scheduling it
  • Loading branch information
Gianluca committed Jun 26, 2019
2 parents 7bdc4a1 + 7e048c1 commit 2f311df
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


setup(
version='5.1.0',
version='5.1.1',
name='vcdriver',
description='A vcenter driver based on pyvmomi, fabric and pywinrm',
url='https://github.com/Osirium/vcdriver',
Expand Down
4 changes: 3 additions & 1 deletion test/unit/test_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ def test_virtual_machine_power_off_with_delay(wait_for_vcenter_task, connection)
mock_schedule_vcenter_task_on_vm = mock.MagicMock()
vm.__setattr__('_schedule_vcenter_task_on_vm', mock_schedule_vcenter_task_on_vm)
vm.power_off(delay_by=datetime.timedelta(hours=1))
vm.__setattr__('_vm_object', mock.MagicMock())
vm_object_mock = mock.MagicMock()
vm_object_mock.summary.vm = "'vim.VirtualMachine:vm-83288'"
vm.__setattr__('_vm_object', vm_object_mock)
vm.power_off(delay_by=datetime.timedelta(hours=1))
assert wait_for_vcenter_task.call_count == 0
assert mock_schedule_vcenter_task_on_vm.call_count == 1
Expand Down
3 changes: 2 additions & 1 deletion vcdriver/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ def power_off(self, delay_by=None):
else:
self._schedule_vcenter_task_on_vm(
vim.VirtualMachine.PowerOff,
'Power off virtual machine "{}"'.format(self.name),
# task name can't be longer than 80 chars and as to be unique
'Power off {}'.format(self.vm_id()),
delay_by
)

Expand Down

0 comments on commit 2f311df

Please sign in to comment.