Skip to content
This repository has been archived by the owner on Feb 24, 2022. It is now read-only.

Commit

Permalink
Sync bitbucket and GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
carchi8py committed Mar 3, 2021
1 parent 91ce2e2 commit 5b75959
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
3 changes: 2 additions & 1 deletion ansible_collections/netapp/elementsw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Join our Slack Channel at [Netapp.io](http://netapp.io/slack)

### Bug Fixes
- na_elementsw_drive - latest SDK does not accept ``force_during_bin_sync`` and ``force_during_upgrade``.
- na_elementsw_qos_policy: loop would convert `minIOPS`, `maxIOPS`, `burstIOPS` to str, causing type mismatch issues in comparisons.
- na_elementsw_qos_policy - loop would convert `minIOPS`, `maxIOPS`, `burstIOPS` to str, causing type mismatch issues in comparisons.
- na_elementsw_snapshot_schedule - change of interface in SDK ('ScheduleInfo' object has no attribute 'minutes')

## 20.11.0

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- na_elementsw_snapshot_schedule - change of interface in SDK ('ScheduleInfo' object has no attribute 'minutes')
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,20 @@
HAS_SF_SDK = netapp_utils.has_sf_sdk()
try:
from solidfire.custom.models import DaysOfWeekFrequency, Weekday, DaysOfMonthFrequency
from solidfire.common import ApiServerError
from solidfire.common import ApiConnectionError, ApiServerError
from solidfire.custom.models import TimeIntervalFrequency
from solidfire.models import Schedule, ScheduleInfo
except ImportError:
HAS_SF_SDK = False

try:
# Hack to see if we we have the 1.7 version of the SDK, or later
from solidfire.common.model import VER3
HAS_SF_SDK_1_7 = True
del VER3
except ImportError:
HAS_SF_SDK_1_7 = False


class ElementSWSnapShotSchedule(object):
"""
Expand Down Expand Up @@ -397,16 +405,18 @@ def create_schedule(self):
snapshot_name=self.snapshot_name,
retention=self.retention
)

sched = Schedule(schedule_info, name, frequency)
if HAS_SF_SDK_1_7:
sched = Schedule(frequency, name, schedule_info)
else:
sched = Schedule(schedule_info, name, frequency)
sched.paused = self.paused
sched.recurring = self.recurring
sched.starting_date = self.starting_date

self.create_schedule_result = self.sfe.create_schedule(sched)

except Exception as e:
self.module.fail_json(msg='Error creating schedule %s: %s' % (self.name, to_native(e)),
except (ApiServerError, ApiConnectionError) as exc:
self.module.fail_json(msg='Error creating schedule %s: %s' % (self.name, to_native(exc)),
exception=traceback.format_exc())

def delete_schedule(self, schedule_id):
Expand All @@ -417,8 +427,8 @@ def delete_schedule(self, schedule_id):
sched.to_be_deleted = True
self.sfe.modify_schedule(schedule=sched)

except Exception as e:
self.module.fail_json(msg='Error deleting schedule %s: %s' % (self.name, to_native(e)),
except (ApiServerError, ApiConnectionError) as exc:
self.module.fail_json(msg='Error deleting schedule %s: %s' % (self.name, to_native(exc)),
exception=traceback.format_exc())

def update_schedule(self, schedule_id):
Expand Down Expand Up @@ -447,8 +457,8 @@ def update_schedule(self, schedule_id):
# Make API call
self.sfe.modify_schedule(schedule=sched)

except Exception as e:
self.module.fail_json(msg='Error updating schedule %s: %s' % (self.name, to_native(e)),
except (ApiServerError, ApiConnectionError) as exc:
self.module.fail_json(msg='Error updating schedule %s: %s' % (self.name, to_native(exc)),
exception=traceback.format_exc())

def apply(self):
Expand Down Expand Up @@ -496,8 +506,8 @@ def apply(self):
update_schedule = True
changed = True
elif self.volumes is not None and len(self.volumes) > 0:
for volumeID in schedule_detail.schedule_info.volume_ids:
if volumeID not in self.volumes:
for volume_id in schedule_detail.schedule_info.volume_ids:
if volume_id not in self.volumes:
update_schedule = True
changed = True

Expand Down Expand Up @@ -568,8 +578,8 @@ def apply(self):


def main():
v = ElementSWSnapShotSchedule()
v.apply()
sss = ElementSWSnapShotSchedule()
sss.apply()


if __name__ == '__main__':
Expand Down

0 comments on commit 5b75959

Please sign in to comment.