Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/include/register.global.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2719 by niro, Fri Dec 18 10:48:29 2015 UTC revision 2832 by niro, Wed Aug 30 13:54:01 2017 UTC
# Line 10  validate_client() Line 10  validate_client()
10   local os   local os
11   local tools   local tools
12   local netboot   local netboot
13     local location
14    
15   if [[ -z ${mac_address} ]]   if [[ -z ${mac_address} ]]
16   then   then
# Line 70  validate_client() Line 71  validate_client()
71   mysqldo "update state_connected set netboot='${netboot}' where serial=${serial};"   mysqldo "update state_connected set netboot='${netboot}' where serial=${serial};"
72   fi   fi
73    
74     # get location from cmdline and update the client_serials.location entry
75     nsslsay_queue_init
76     nsslsay_queue_add "nocolors"
77     nsslsay_queue_add "get system.cmdline MCORE_LOCATION="
78     location=$(control_client "${serial}" run-queue)
79     # update location
80     if [[ -n ${location} ]]
81     then
82     mysqldo "update client_serials set location='${location}' where serial=${serial};"
83     fi
84    
85   # update tools and os version info   # update tools and os version info
86   nsslsay_queue_init   nsslsay_queue_init
87   nsslsay_queue_add "nocolors"   nsslsay_queue_add "nocolors"
# Line 81  validate_client() Line 93  validate_client()
93   nsslsay_queue_add "get version.tools"   nsslsay_queue_add "get version.tools"
94   tools=$(control_client "${serial}" run-queue)   tools=$(control_client "${serial}" run-queue)
95   import_resource client_version "${serial}" utils "${tools}"   import_resource client_version "${serial}" utils "${tools}"
96     nsslsay_queue_init
97     nsslsay_queue_add "nocolors"
98     nsslsay_queue_add "get system.arch"
99     osarch=$(control_client "${serial}" run-queue)
100     import_resource client_version "${serial}" arch "${osarch}"
101    
102   # run hardware detection   # run hardware detection
103   if is_provided hardware   if is_provided hardware
# Line 94  validate_client() Line 111  validate_client()
111    
112  register_client()  register_client()
113  {  {
114     local control_server
115   local control_server_ip   local control_server_ip
116   local iface_ip   local iface_ip
117   local iface   local iface
118   local mac_address   local mac_address
119    
120   control_server_ip=$(dns_to_ip ${MCORE_CONTROL_SERVER})   control_server=$(mcore-controlserver)
121   iface_ip=$(iface_for_remote_addr ${control_server_ip})   if [[ $? != 0 ]]
122   iface=$(iface_for_ip ${iface_ip})   then
123     decho "Could not communicate with the controlserver"
124     return 1
125     fi
126    
127     control_server_ip=$(dns_to_ip ${control_server})
128     if [[ -z ${control_server_ip} ]]
129     then
130     decho "Could not resolve control server ip, dns_to_ip(${control_server}) failed"
131     return 1
132     fi
133    
134     iface=$(iface_for_remote_addr ${control_server_ip})
135     if [[ -z ${iface} ]]
136     then
137     decho "Could not resolve interface for referencing ip address, iface_for_remote_addr(${control_server_ip}) failed"
138     return 1
139     fi
140    
141     iface_ip=$(get_iface_ip ${iface})
142     if [[ -z ${iface_ip} ]]
143     then
144     decho "Could not resolve interface ip, get_ip(${iface}) failed"
145     return 1
146     fi
147    
148   mac_address=$(mac_for_iface ${iface})   mac_address=$(mac_for_iface ${iface})
149     if [[ -z ${mac_address} ]]
150     then
151     decho "Could not resolve mac address, mac_for_iface(${iface}) failed"
152     return 1
153     fi
154    
155   decho "MCORE_CONTROL_SERVER='${MCORE_CONTROL_SERVER}'"   decho "control_server='${control_server}'"
156   decho "iface_ip='${iface_ip}'"   decho "iface_ip='${iface_ip}'"
157   decho "iface='${iface}'"   decho "iface='${iface}'"
158   decho "mac_address='${mac_address}'"   decho "mac_address='${mac_address}'"

Legend:
Removed from v.2719  
changed lines
  Added in v.2832