Ignore:
Timestamp:
Aug 16, 2012, 8:12:00 AM (12 years ago)
Author:
joergs
Message:

bugfix: don't overwrite ip and mac, when copying a client a second time

File:
1 edited

Legend:

Unmodified
Added
Removed
  • opsi/server/dass-opsi-tools/usr/bin/opsi-client

    r1063 r1064  
    9191   
    9292        print "create/update", dst, "from template", src + ":",
    93         #method host_createOpsiClient id *opsiHostKey *description *notes *hardwareAddress *ipAddress *inventoryNumber *oneTimePassword *created *lastSeen
    94         #id=dst
    95         opsiHostKey=None
    96         description=""
    97         notes="copy of " + src
    98         self.rpc.host_createOpsiClient( dst, opsiHostKey, description, notes, hardwareAddress, ipAddress )
     93        obj = {
     94          "id" : dst,
     95          "type" : "OpsiClient",
     96          "notes" : "copy of " + src,
     97          #"description" : "",
     98          #"inventoryNumber" : "",
     99        }
     100        if hardwareAddress:
     101            obj['hardwareAddress'] = hardwareAddress
     102        if ipAddress:
     103            obj['ipAddress'] = ipAddress
     104
     105        if self.exists( dst ):
     106            self.rpc.host_updateObject(obj)
     107        else:
     108            self.rpc.host_insertObject(obj)
     109           
    99110        if depot:
    100111            self.rpc.configState_create( "clientconfig.depot.id", dst, depot )       
     112           
    101113        if self.debug:
    102114            pprint( self.getProductOnClient( src ) )
Note: See TracChangeset for help on using the changeset viewer.