def _can_update(subnet, module, cloud):
 network_name = module.params['network_name']
 cidr = module.params['cidr']
 ip_version = int(module.params['ip_version'])
 ipv6_ra_mode = module.params['ipv6_ra_mode']
 ipv6_a_mode = module.params['ipv6_address_mode']
 if network_name:
  network = cloud.get_network(network_name)
  if network:
   netid = network['id']
  else:
   module.fail_json(msg=('No network found for %s' % network_name))
  if (netid != subnet['network_id']):
   module.fail_json(msg='Cannot update network_name in existing                                       subnet')
 if (ip_version and (subnet['ip_version'] != ip_version)):
  module.fail_json(msg='Cannot update ip_version in existing subnet')
 if (ipv6_ra_mode and (subnet.get('ipv6_ra_mode', None) != ipv6_ra_mode)):
  module.fail_json(msg='Cannot update ipv6_ra_mode in existing subnet')
 if (ipv6_a_mode and (subnet.get('ipv6_address_mode', None) != ipv6_a_mode)):
  module.fail_json(msg='Cannot update ipv6_address_mode in existing                               subnet')

def _can_update ( subnet , module , cloud ) : network_name = module . params [ 'network_name' ] cidr = module . params [ 'cidr' ] ip_version = int ( module . params [ 'ip_version' ] ) ipv6_ra_mode = module . params [ 'ipv6_ra_mode' ] ipv6_a_mode = module . params [ 'ipv6_address_mode' ] if network_name : network = cloud . get_network ( network_name ) if network : netid = network [ 'id' ] else : module . fail_json ( msg = ( 'No network found for %s' % network_name ) ) if ( netid != subnet [ 'network_id' ] ) : module . fail_json ( msg = 'Cannot update network_name in existing                                       subnet' ) if ( ip_version and ( subnet [ 'ip_version' ] != ip_version ) ) : module . fail_json ( msg = 'Cannot update ip_version in existing subnet' ) if ( ipv6_ra_mode and ( subnet . get ( 'ipv6_ra_mode' , None ) != ipv6_ra_mode ) ) : module . fail_json ( msg = 'Cannot update ipv6_ra_mode in existing subnet' ) if ( ipv6_a_mode and ( subnet . get ( 'ipv6_address_mode' , None ) != ipv6_a_mode ) ) : module . fail_json ( msg = 'Cannot update ipv6_address_mode in existing                               subnet' )
check for differences in non-updatable values .