Package actions :: Module hardware
[hide private]
[frames] | no frames]

Source Code for Module actions.hardware

 1  #!/usr/bin/python2 
 2   
 3   
 4  # Copyright (c) 1999--2018 Red Hat, Inc.  Distributed under GPLv2. 
 5  # 
 6  # Author: Adrian Likins <alikins@redhat.com> 
 7   
 8   
 9  # imports are a bit weird here to avoid name collions on "harware" 
10  from up2date_client import hardware 
11  from up2date_client import up2dateAuth 
12  from up2date_client import rpcServer 
13  argVerbose = 0 
14   
15  __rhnexport__ = [ 
16      'refresh_list' ] 
17   
18  # resync hardware information with the server profile 
19 -def refresh_list(cache_only=None):
20 if cache_only: 21 return (0, "no-ops for caching", {}) 22 23 # read all hardware in 24 hardwareList = hardware.Hardware() 25 26 s = rpcServer.getServer() 27 28 if argVerbose > 1: 29 print("Called refresh_hardware") 30 31 try: 32 s.registration.refresh_hw_profile(up2dateAuth.getSystemId(), 33 hardwareList) 34 except: 35 print("ERROR: sending hardware database for System Profile") 36 return (12, "Error refreshing system hardware", {}) 37 38 return (0, "hardware list refreshed", {})
39
40 -def main():
41 print(refresh_list())
42 43 if __name__ == "__main__": 44 main() 45