Skip to content

Commit

Permalink
feat(snmp_v3_trap_destinations): Implement check mode
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Simon <[email protected]>
  • Loading branch information
arth-simon committed Feb 27, 2024
1 parent c88b3e5 commit d931f05
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
###
# Copyright (2021) Hewlett Packard Enterprise Development LP
# Copyright (2021-2024) Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
Expand Down Expand Up @@ -136,7 +136,7 @@ class ApplianceDeviceSnmpV3TrapDestinationsModule(OneViewModule):
)

def __init__(self):
super().__init__(additional_arg_spec=self.argument_spec, validate_etag_support=True)
super().__init__(additional_arg_spec=self.argument_spec, validate_etag_support=True, supports_check_mode=True)
self.set_resource_object(self.oneview_client.appliance_device_snmp_v3_trap_destinations)

def execute_module(self):
Expand All @@ -147,9 +147,15 @@ def execute_module(self):
self.__replace_snmpv3_username_by_userid()

if self.state == 'present':
result = self.resource_present(self.RESOURCE_FACT_NAME)
if not self.module.check_mode:
result = self.resource_present(self.RESOURCE_FACT_NAME)
else:
result = self.check_resource_present(self.RESOURCE_FACT_NAME)
elif self.state == 'absent':
result = self.resource_absent()
if not self.module.check_mode:
result = self.resource_absent()
else:
result = self.check_resource_absent()

if not self.module.params.get("sessionID"):
self.oneview_client.connection.logout()
Expand Down

0 comments on commit d931f05

Please sign in to comment.