Commit 96d7d3909c897f386279c012c6f683f55528ef3a
Committed by
Eduardo Santos
1 parent
353c1c7f
Exists in
master
and in
1 other branch
Corrige a coleta para forçar atualizaçao no getTest e melhorias de relatorio do Cocar
Showing
3 changed files
with
39 additions
and
12 deletions
Show diff stats
src/Cacic/WSBundle/Controller/DefaultController.php
... | ... | @@ -78,24 +78,22 @@ class DefaultController extends Controller |
78 | 78 | $strComputerSystem = OldCacicHelper::deCrypt( $request, $request->get('ComputerSystem') ); |
79 | 79 | $strOperatingSystem = OldCacicHelper::deCrypt( $request, $request->request->get('OperatingSystem') ); |
80 | 80 | |
81 | - $teste = $strNetworkAdapterConfiguration; | |
82 | - #$logger->debug("00000000000000000000000000000000000000000000 ".print_r($teste, true)); | |
83 | 81 | |
84 | 82 | $te_node_address = TagValueHelper::getValueFromTags( 'MACAddress', $strNetworkAdapterConfiguration ); |
85 | 83 | $netmask = TagValueHelper::getValueFromTags( 'IPSubnet', $strNetworkAdapterConfiguration ); |
86 | 84 | $te_so = $request->get( 'te_so' ); |
87 | 85 | $ultimo_login = TagValueHelper::getValueFromTags( 'UserName' , $strComputerSystem); |
88 | 86 | $ip_computador = $request->get('te_ip_computador'); |
89 | - #$logger->debug("11111111111111111111111111111111111: $ip_computador"); | |
87 | + | |
90 | 88 | if ( empty($ip_computador) ){ |
91 | 89 | $ip_computador = TagValueHelper::getValueFromTags( 'IPAddress', $strNetworkAdapterConfiguration ); |
92 | - #$logger->debug("555555555555555555555555555555555555555555: $ip_computador"); | |
90 | + | |
93 | 91 | } |
94 | - #$logger->debug("22222222222222222222222222222222222: $ip_computador"); | |
92 | + | |
95 | 93 | if (empty($ip_computador)) { |
96 | 94 | $ip_computador = $request->getClientIp(); |
97 | 95 | } |
98 | - #$logger->debug("333333333333333333333333333333333333: $ip_computador"); | |
96 | + | |
99 | 97 | $logger->debug("Teste de Conexão GET-TEST! Ip do computador: $ip_computador Máscara da rede: $netmask"); |
100 | 98 | |
101 | 99 | // Caso não tenha encontrado, tenta pegar a variável da requisição |
... | ... | @@ -110,6 +108,25 @@ class DefaultController extends Controller |
110 | 108 | //vefifica se existe SO coletado se não, insere novo SO |
111 | 109 | $so = $this->getDoctrine()->getRepository('CacicCommonBundle:So')->createIfNotExist( $te_so ); |
112 | 110 | $rede = $this->getDoctrine()->getRepository('CacicCommonBundle:Rede')->getDadosRedePreColeta( $ip_computador, $netmask ); |
111 | + | |
112 | + if (empty($netmask) || (empty($te_node_address)) || empty($so)) { | |
113 | + $this->get('logger')->error("Erro na operação de getTest. Máscara = $netmask. MAC = $te_node_address. SO = $te_so"); | |
114 | + | |
115 | + $response = new Response(); | |
116 | + $response->headers->set('Content-Type', 'xml'); | |
117 | + $cacic_helper = new OldCacicHelper($this->get('kernel')); | |
118 | + | |
119 | + return $this->render('CacicWSBundle:Default:testUpdate.xml.twig', array( | |
120 | + 'configs'=> $cacic_helper->getTest( $request ), | |
121 | + //'computador' => $computador, | |
122 | + 'rede' => $rede, | |
123 | + //'debugging' => $debugging, | |
124 | + 'ws_folder' => OldCacicHelper::CACIC_WEB_SERVICES_FOLDER_NAME, | |
125 | + 'cs_cipher' => $request->get('cs_cipher'), | |
126 | + 'cs_compress' => $request->get('cs_compress') | |
127 | + ), $response); | |
128 | + } | |
129 | + | |
113 | 130 | #$logger->debug("444444444444444444444444444444444444: $netmask | ".$rede->getNmRede()); |
114 | 131 | $computador = $this->getDoctrine()->getRepository('CacicCommonBundle:Computador')->getComputadorPreCole( $request, $te_so, $te_node_address, $rede, $so, $ip_computador ); |
115 | 132 | //$local = $this->getDoctrine()->getRepository('CacicCommonBundle:Local')->findOneBy(array( 'idLocal' => $rede->getIdLocal() )); |
... | ... | @@ -185,7 +202,6 @@ class DefaultController extends Controller |
185 | 202 | $ip_computador = $request->get('te_ip_computador'); |
186 | 203 | if ( empty($ip_computador) ){ |
187 | 204 | $ip_computador = TagValueHelper::getValueFromTags( 'IPAddress', $strNetworkAdapterConfiguration ); |
188 | - #$logger->debug("555555555555555555555555555555555555555555: $ip_computador"); | |
189 | 205 | } |
190 | 206 | if (empty($ip_computador)) { |
191 | 207 | $ip_computador = $request->getClientIp(); |
... | ... | @@ -202,16 +218,17 @@ class DefaultController extends Controller |
202 | 218 | $netmask = $request->get('netmask'); |
203 | 219 | } |
204 | 220 | |
221 | + $so = $this->getDoctrine()->getRepository('CacicCommonBundle:So')->findOneBy( array('teSo'=>$request->get( 'te_so' ))); | |
222 | + | |
205 | 223 | /** |
206 | 224 | * Se a máscara de subrede ou o mac address estiver vazio, força o redirecionamento para provável atualização |
207 | 225 | */ |
208 | - if (empty($netmask) || (empty($te_node_address))) { | |
209 | - | |
210 | - return $this->forward('CacicWSBundle:Default:update', $this->getRequest()->request->all()); | |
226 | + if (empty($netmask) || (empty($te_node_address)) || empty($so)) { | |
227 | + $this->get('logger')->error("Erro na operação de getConfig. Máscara = $netmask. MAC = $te_node_address. SO = $request->get( 'te_so' )"); | |
211 | 228 | |
229 | + return $this->forward('CacicWSBundle:Default:update', $this->getRequest()->request->all()); | |
212 | 230 | } |
213 | 231 | |
214 | - $so = $this->getDoctrine()->getRepository('CacicCommonBundle:So')->findOneBy( array('teSo'=>$request->get( 'te_so' ))); | |
215 | 232 | $rede = $this->getDoctrine()->getRepository('CacicCommonBundle:Rede')->getDadosRedePreColeta( $ip_computador, $netmask ); |
216 | 233 | $computador = $this->getDoctrine()->getRepository('CacicCommonBundle:Computador')->getComputadorPreCole( $request, $request->get( 'te_so' ),$te_node_address, $rede, $so, $ip_computador ); |
217 | 234 | //$local = $this->getDoctrine()->getRepository('CacicCommonBundle:Local')->findOneBy(array( 'idLocal' => $rede->getIdLocal() )); | ... | ... |
src/Cacic/WSBundle/Resources/views/Default/config.xml.twig
... | ... | @@ -15,7 +15,7 @@ |
15 | 15 | |
16 | 16 | {% for modulo in redes_versoes_modulos %} |
17 | 17 | {% if agente_py == true %} |
18 | - <TE_PACOTE_PYCACIC_DISPONIVEL>{{ modulo.getTeVersaoModulo() }}</TE_PACOTE_PYCACIC_DISPONIVEL}}> | |
18 | + <TE_PACOTE_PYCACIC_DISPONIVEL>{{ modulo.getTeVersaoModulo() }}</TE_PACOTE_PYCACIC_DISPONIVEL> | |
19 | 19 | <TE_PACOTE_PYCACIC_HASH>{{ modulo.getTeHash() }}</TE_PACOTE_PYCACIC_HASH> |
20 | 20 | {% else %} |
21 | 21 | <{{ modulo.getNmModulo() |upper }}_VER>{{ modulo.getTeVersaoModulo() }}</{{ modulo.getNmModulo() |upper }}_VER> | ... | ... |
src/Cacic/WSBundle/Resources/views/Default/testUpdate.xml.twig
0 → 100644
... | ... | @@ -0,0 +1,10 @@ |
1 | +{% extends 'CacicWSBundle::common.xml.twig' %} | |
2 | +{% block bodyXML %} | |
3 | + <WebManagerAddress>{{ rede.getTeServCacic() }}</WebManagerAddress> | |
4 | + <WebServicesFolderName>{{ ws_folder }}</WebServicesFolderName> | |
5 | + <cs_compress>{{ cs_compress }}</cs_compress> | |
6 | + <cs_cipher>{{ cs_cipher }}</cs_cipher> | |
7 | + <INSTALLCACIC.EXE_HASH>{{ configs['INSTALLCACIC.EXE_HASH'] }}</INSTALLCACIC.EXE_HASH> | |
8 | + <MainProgramName>{{ configs.MainProgramName }}</MainProgramName> | |
9 | + <LocalFolderName>{{ configs.LocalFolderName }}</LocalFolderName> | |
10 | +{% endblock %} | |
0 | 11 | \ No newline at end of file | ... | ... |