def server_exists(client, module): log('Checking if server exists') try: server.get(client, module.params['name']) return True except nitro_exception: return False
def server_identical(client, module, server_proxy): log('Checking if configured server is identical') try: server.get(client, module.params['name']) except nitro_exception: return False diff = diff_list(client, module, server_proxy) # Remove options that are not present in nitro server object # These are special options relevant to the disabled action for option in ['graceful', 'delay']: if option in diff: del diff[option] if diff == {}: return True else: return False
def diff_list(client, module, server_proxy): ret_val = server_proxy.diff_object(server.get(client, module.params['name'])), return ret_val[0]