MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / resolve_git_conflicts

Function resolve_git_conflicts

webapp_modern.py:10235–10267  ·  view source on GitHub ↗

Resolve git merge conflicts by resetting to HEAD then pulling latest.

()

Source from the content-addressed store, hash-verified

10233 arp_mac = arp_hosts[ip].get('mac', '')
10234 if arp_mac and (not data.get('mac') or data['mac'] in ['', 'Unknown', '00:00:00:00:00:00'] or
10235 data['mac'].startswith('00:00:c0:a8:01:')): # Replace pseudo MACs
10236 data['mac'] = arp_mac
10237 # Also update NetKB database with real MAC
10238 try:
10239 arp_hostname = arp_hosts[ip].get('hostname', data.get('hostname', ''))
10240 update_netkb_entry(ip, arp_hostname, arp_mac, True)
10241 except Exception as e:
10242 logger.debug(f"Could not update NetKB with real MAC for {ip}: {e}")
10243 else:
10244 # Device didn't respond - only increment counter if we have fresh ARP data
10245 if arp_data_is_fresh:
10246 data['failed_ping_count'] = data.get('failed_ping_count', 0) + 1
10247 data['last_ping_attempt'] = current_time
10248
10249 # Only mark as offline after MAX_FAILED_PINGS consecutive failures
10250 if data['failed_ping_count'] >= MAX_FAILED_PINGS:
10251 data['alive'] = False
10252 logger.info(f"Device {ip} marked offline after {data['failed_ping_count']} consecutive failed pings")
10253 else:
10254 # IMPORTANT: Keep device as "alive" until it exceeds the failure limit
10255 # This implements the proper 15-ping rule you requested
10256 data['alive'] = True # Don't change to False until 15 failures
10257 # Only log devices approaching the failure threshold to reduce noise
10258 if data['failed_ping_count'] >= MAX_FAILED_PINGS - 3:
10259 logger.debug(f"Device {ip} failed ping {data['failed_ping_count']}/{MAX_FAILED_PINGS} - keeping alive per 15-ping rule")
10260
10261 # Time-based status transitions (offline/lost)
10262 offline_hours = shared_data.config.get('network_offline_hours', 3)
10263 lost_days = shared_data.config.get('network_lost_days', 8)
10264 try:
10265 offline_hours = float(offline_hours)
10266 except (TypeError, ValueError):
10267 offline_hours = 3
10268 try:
10269 lost_days = float(lost_days)
10270 except (TypeError, ValueError):

Callers

nothing calls this directly

Calls 5

_execute_git_updateFunction · 0.85
infoMethod · 0.80
errorMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected