Skip to content
Snippets Groups Projects
Select Git revision
  • 9c046b808c295f20614c1bfce60d103528f7a0c8
  • master default protected
  • rednatco-v2
  • rednatco
  • test
  • ntc-tube-uniform-color
  • ntc-tube-missing-atoms
  • restore-vertex-array-per-program
  • watlas2
  • dnatco_new
  • cleanup-old-nodejs
  • webmmb
  • fix_auth_seq_id
  • update_deps
  • ext_dev
  • ntc_balls
  • nci-2
  • plugin
  • bugfix-0.4.5
  • nci
  • servers
  • v0.5.0-dev.1
  • v0.4.5
  • v0.4.4
  • v0.4.3
  • v0.4.2
  • v0.4.1
  • v0.4.0
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • v0.3.3
  • v0.3.2
  • v0.3.1
  • v0.3.0
41 results

builder.ts

Blame
  • WardenClientReceive.pm 4.71 KiB
    #!/usr/bin/perl -w
    #                                                                    
    # WardenClientReceive.pm
    #
    # Copyright (C) 2011-2012 Cesnet z.s.p.o
    #
    # Use of this source is governed by a BSD-style license, see LICENSE file.  
    
    package WardenClientReceive;
    
    use strict;
    use SOAP::Lite;
    use IO::Socket::SSL qw(debug1);
    use SOAP::Transport::HTTP;
    use FindBin;
    use Sys::Syslog;
    
    our $VERSION = "2.1";
    
    #-------------------------------------------------------------------------------
    # getNewEvents - get new events from warden server greater than last received ID
    #-------------------------------------------------------------------------------
    sub getNewEvents
    {
      my @events;  
    
      eval {
    
        my $warden_path = shift;
        my $requested_type = shift;
    
        my $vardir = $warden_path . "/var/";
        my $etcdir = $warden_path . "/etc/";
        my $libdir = $warden_path . "/lib/";
    
        require $libdir . "WardenClientConf.pm";
        require $libdir . "WardenClientCommon.pm";
    
        # read the config file
        my $conf_file = $etcdir . "warden-client.conf";
        WardenClientConf::loadConf($conf_file);
    
        # set name of ID file for each client aplication 
        my $caller_name = $FindBin::Script;
        my $id_file = $vardir . $caller_name . ".id";
    
        #-----------------------------------------------------------------------------
        # get last ID from ID file (if exist) or
        # get last ID from warden server DB and save it into ID file
        my $last_id;
        if (-e $id_file) {
          open(ID, "< $id_file") || WardenClientCommon::errMsg("Cannot open ID file $id_file: $!");
          foreach(<ID>) {
            $last_id = $_;
          }
          close ID;
        } else {
          my $response = WardenClientCommon::c2s($WardenClientConf::URI, $WardenClientConf::SSL_KEY_FILE, $WardenClientConf::SSL_CERT_FILE, $WardenClientConf::SSL_CA_FILE, "getLastId");
          $last_id = $response->result;
          open(ID, "> $id_file") || WardenClientCommon::errMsg("Cannot open ID file $id_file: $!");
          print ID $last_id;
          close ID;
        }
    
        #-----------------------------------------------------------------------------
        # get new events from warden server DB based on gathered last ID 
    
        # create SOAP data obejct
        my $request_data = SOAP::Data->name(
          request => \SOAP::Data->value(