Ignore:
Timestamp:
May 13, 2015, 4:46:01 PM (9 years ago)
Author:
joergs
Message:

allow setting the inventory number when updating the client

File:
1 edited

Legend:

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

    r1176 r1177  
    113113    def createClient(self, name, opsiHostKey, description, notes, hardwareAddress, ipAddress):
    114114        #    self.rpc.host_createOpsiClient( name, opsiHostKey, description, notes, hardwareAddress, ipAddress )
    115         self.updateClient( name, opsiHostKey, description, notes, hardwareAddress, ipAddress )
     115        self.updateClient( name, opsiHostKey, description, notes, None, hardwareAddress, ipAddress )
    116116
    117117    def deleteClient(self, name):
    118118        self.rpc.host_delete( name )
    119119
    120     def updateClient(self, src, opsiHostKey = None, description = None, notes = None, hardwareAddress = None, ipAddress = None, depot = None ):
     120    def updateClient(self, src, opsiHostKey = None, description = None, notes = None, inventoryNumber = None, hardwareAddress = None, ipAddress = None, depot = None ):
    121121        obj = {
    122122          "id" : src,
     
    129129        if notes:
    130130            obj['notes'] = notes
     131        if inventoryNumber:
     132            obj['inventoryNumber'] = inventoryNumber
    131133        if hardwareAddress:
    132134            obj['hardwareAddress'] = hardwareAddress
     
    312314            fd.write( "# automatically generated at {0}\n".format( time.asctime() ) )
    313315            fd.write( "#\n\n" )
    314         except BaseException as e:       
     316        except BaseException as e:
    315317            self.logger.exception( "failed to create files" )
    316318            return False
     
    395397
    396398    parser_update = subparsers.add_parser('update', help='update/create a opsi client')
    397     parser_update.add_argument( 'src', help="opsi client to be created" )
    398     parser_update.add_argument( '--ip', help="IP address of the new opsi client" )
    399     parser_update.add_argument( '--mac', help="MAC address of the new opsi client" )
    400     parser_update.add_argument( '--description', help="IP address of the new opsi client" )
    401     parser_update.add_argument( '--notes', help="MAC address of the new opsi client" )   
    402     parser_update.add_argument( '--depot', help="depot server the new opsi client should be located" )
    403    
     399    parser_update.add_argument( 'src', help="opsi client to be created/updated" )
     400    parser_update.add_argument( '--ip', help="IP address of the opsi client" )
     401    parser_update.add_argument( '--mac', help="MAC address of the opsi client" )
     402    parser_update.add_argument( '--description', help="a description of the client" )
     403    parser_update.add_argument( '--notes', help="notes about the client" )
     404    parser_update.add_argument( '--inventory', help="inventory number" )
     405    parser_update.add_argument( '--depot', help="depot server the opsi client should be located" )
     406
    404407    args = parser.parse_args()
    405    
     408
    406409    if args.debug:
    407410        logger.setLevel(logging.DEBUG)
     
    439442            result = opsi.info( args.src )
    440443        elif args.subcommand == "update":
    441             result = opsi.updateClient( args.src, None, args.description, args.notes, args.mac, args.ip, args.depot )
     444            result = opsi.updateClient( args.src, None, args.description, args.notes, args.inventory, args.mac, args.ip, args.depot )
    442445        else:
    443446            print "not yet implemented"
Note: See TracChangeset for help on using the changeset viewer.