Commit 16e6fe37 authored by Harsh Shah's avatar Harsh Shah

Added option --advance-by to allow advancing of lease start date

Added option --advance-by to the mutually exclusive group containing
--defer-by to allow the user to advance the start date of a lease.

Change-Id: I4cb801e29407917f3d409a7866bd53ec2184e93d
Closes-Bug: 1314791
parent ca07062c
......@@ -36,14 +36,14 @@ class LeaseClientManager(base.BaseClientManager):
return self._get('/leases/%s' % lease_id, 'lease')
def update(self, lease_id, name=None, prolong_for=None, reduce_by=None,
advance_by=None, defer_by=None):
"""Update attributes of the lease."""
values = {}
if name:
values['name'] = name
lease_end_date_change = prolong_for or reduce_by
lease_start_date_change = defer_by
lease_start_date_change = defer_by or advance_by
lease = None
if lease_end_date_change:
......@@ -57,7 +57,7 @@ class LeaseClientManager(base.BaseClientManager):
lease = self.get(lease_id)
self._add_lease_date(values, lease, 'start_date',
defer_by is not None)
if not values:
return _('No values to update passed.')
......@@ -258,6 +258,11 @@ class UpdateLease(command.UpdateCommand):
help='Time to defer the lease start',
help='Time to advance the lease start',
return parser
......@@ -271,6 +276,8 @@ class UpdateLease(command.UpdateCommand):
params['reduce_by'] = parsed_args.reduce_by
if parsed_args.defer_by:
params['defer_by'] = parsed_args.defer_by
if parsed_args.advance_by:
params['advance_by'] = parsed_args.advance_by
return params
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment