Changeset 9823 for src/django_gheat


Ignore:
Timestamp:
Dec 23, 2011, 9:16:20 AM (13 years ago)
Author:
rick
Message:

Importer fails if one file files, this makes it more reliable...

Location:
src/django_gheat
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/fabfile.py

    r9817 r9823  
    4141    run("./manage.py sqlreset gheat | ./manage.py dbshell")
    4242    sudo("./import_scan_data.sh", user='wlrobot')
    43     sudo("svn up ../genesis", user='wlrobot')
    44     sudo("../genesis/tools/genesis-to-yaml.pl", user='wlrobot')
    45     sudo("../genesis/tools/gformat.py cleanup", user='wlrobot')
     43    sudo("svn up ../genesis", user='www')
     44    sudo("../genesis/tools/genesis-to-yaml.pl", user='www')
     45    sudo("../genesis/tools/gformat.py cleanup", user='www')
    4646    run("../genesis/tools/gformat.py full-export | ./manage.py import_nodes -")
  • src/django_gheat/gheat/management/commands/import_datafile.py

    r9819 r9823  
    123123    apparatuur, created = Apparatuur.objects.get_or_create(kaart=options['kaart'])
    124124
     125    # Meetrondje is deducted and checked from first filename
     126    filename = args[0]
     127    logger.info("Processing '%s'" % filename)
     128    meetrondje, created = MeetRondje.objects.get_or_create(
     129      datum=get_date(filename), naam=get_meetrondje(filename),
     130      gebruiker=gebruiker, apparatuur=apparatuur)
     131    if not options['force'] and not created:
     132      raise CommandError("Meetrondje '%s' already imported",  meetrondje)
     133
    125134    # Check if all files are valid
    126135    for filename in args:
    127       logger.info("Processing '%s'" % filename)
    128       meetrondje, created = MeetRondje.objects.get_or_create(
    129         datum=get_date(filename), naam=get_meetrondje(filename),
    130         gebruiker=gebruiker, apparatuur=apparatuur)
    131       if not options['force'] and not created:
    132         logger.error("Meetrondje '%s' already imported",  meetrondje)
    133         continue
    134 
    135136      logger.info('Meetrondje: %s', meetrondje)
    136137      meetbestand = MeetBestand(meetrondje=meetrondje,is_imported=True)
  • src/django_gheat/import_scan_data.sh

    r9777 r9823  
    5959done
    6060
    61 #Kismet netxml Imports
    62 FILES="`find $DATAROOT -name '*netxml*' | sort`"
    63 [ -n "$FILES" ] && $MANAGE import_datafile $ARGS $FILES
    64 
    6561# Import all measure data
    6662for USERDIR in `find $DATAROOT -mindepth 1 -maxdepth 1 -type d | sort`; do
     
    7066    ARGS="-g $USERNAME -e $USERNAME@wirelessleiden.nl -k $DEVICE"
    7167
     68    echo "# INFO: Processing $USERNAME/$DEVICE"
    7269    # DroidStumber imports
    7370    FILES=`find $DEVICEDIR -name 'ScanResult-*'`
    74     [ -n "$FILES" ] && $MANAGE import_datafile $ARGS $FILES
     71    if [ -n "$FILES" ]; then
     72      $MANAGE import_datafile $ARGS $FILES
     73    fi
    7574
    76     #Kismet gpsxml Imports
     75    #Kismet Imports
    7776    FILES="`find $DEVICEDIR -name '*gpsxml*'`"
    78     [ -n "$FILES" ] && $MANAGE import_datafile $ARGS $FILES
     77    for GPSXML in $FILES; do
     78      NETXML=`echo $GPSXML | sed 's/gpsxml/netxml/g' `
     79      $MANAGE import_datafile $ARGS $NETXML $GPSXML
     80    done
    7981
    80     # Kismet imports
     82    # NetStumbler imports
    8183    FILES=`find $DEVICEDIR -name '*.ns1'`
    82     [ -n "$FILES" ] && $MANAGE import_datafile $ARGS $FILES
     84    if [ -n "$FILES" ]; then
     85      $MANAGE import_datafile $ARGS $FILES
     86    fi
    8387  done
    8488done
Note: See TracChangeset for help on using the changeset viewer.