Add address enable/disable function

This commit is contained in:
shekhar-cis 2022-05-04 17:31:23 +05:30
parent 271d7fe6ad
commit 61a522e9ab
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7

View File

@ -7,6 +7,7 @@ import logging
from binascii import hexlify, unhexlify
from struct import pack, unpack
from bmconfigparser import BMConfigParser
logger = logging.getLogger('default')
@ -281,3 +282,15 @@ def addBMIfNotPresent(address):
"""Prepend BM- to an address if it doesn't already have it"""
address = str(address).strip()
return address if address[:3] == 'BM-' else 'BM-' + address
def disable_addresses(address):
""""To disable the Address"""
BMConfigParser().set(str(address), 'enabled', 'false')
BMConfigParser().save()
def enable_addresses(address):
""""To enable the Address"""
BMConfigParser().set(address, 'enabled', 'true')
BMConfigParser().save()