Skip to content

Commit 3911bd9

Browse files
committed
support downloads of device config
1 parent 95493a3 commit 3911bd9

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

cterasdk/cio/core/commands.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def __init__(self, function, receiver, path, properties, objects):
363363
self.objects = objects or []
364364

365365
def get_parameter(self):
366-
if self.properties.is_dir:
366+
if self.properties and self.properties.is_dir:
367367
param = Object()
368368
param.paths = [self.path.join(filename).absolute_encode for filename in self.objects] if self.objects else [self.path.absolute]
369369
param.snapshot = None
@@ -380,7 +380,7 @@ def get_parameter(self):
380380

381381
def _before_command(self):
382382
raise_or_suppress_access_error(self._receiver, self.path)
383-
if self.properties.is_dir and self.objects:
383+
if self.properties and self.properties.is_dir and self.objects:
384384
logger.info('Getting handle: %s', [self.path.join(o).relative for o in self.objects])
385385
else:
386386
logger.info('Getting handle: %s', self.path)
@@ -403,19 +403,20 @@ def _handle_exception(self, e):
403403

404404
class Download(PortalCommand):
405405

406-
def __init__(self, function, receiver, path, properties, objects, destination):
406+
def __init__(self, function, receiver, path, properties=None, objects=None, destination=None):
407407
super().__init__(function, receiver)
408408
self.path = automatic_resolution(path, receiver.context)
409409
self.properties = properties
410410
self.objects = objects
411411
self.destination = destination
412412

413413
def get_parameter(self):
414+
archive = self.properties.is_dir if self.properties else False
414415
return commonfs.determine_directory_and_filename(self.path.reference, self.objects,
415-
self.destination, self.properties.is_dir)
416+
self.destination, archive)
416417

417418
def _before_command(self):
418-
if self.properties.is_dir and self.objects:
419+
if self.properties and self.properties.is_dir and self.objects:
419420
logger.info('Downloading: %s', [self.path.join(o).relative for o in self.objects])
420421
else:
421422
logger.info('Downloading: %s', self.path)

0 commit comments

Comments
 (0)