Code

interface change for periodical jobs
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 16 Sep 2009 10:26:46 +0000 (10:26 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 16 Sep 2009 10:26:46 +0000 (10:26 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14257 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/modules/GosaPackages.pm
gosa-si/tests/client.php

index decc502a8159503aee3a5dc8f173efba241a4cf9..f8cfeb72a93284efe80a3e4e44f2498e2c0bc4d5 100644 (file)
@@ -280,19 +280,13 @@ sub process_job_msg {
        
     # Check if it is a periodical job
     my $periodic = 'none';
-    my $periodic_time = 1;
     if (exists $msg_hash->{periodic})
     {
         $periodic = $msg_hash->{periodic}[0];
-        if (not defined $periodic)   # Periodic tag is not defined
-        {
-            $periodic = "";
-        }
-
-        if (not exists $main::check_periodic->{$periodic})   # Periodic tag is not valid
+        if (not $periodic =~ /[0-9]+_(hours|minutes|days|weeks|months)/)    # Periodic tag is not valid
         {
             &main::daemon_log("$session_id ERROR: Message contains invalid periodic-tag '$periodic'.".
-                    " Please use one of the following tags instead: '".join("', '", keys(%$main::check_periodic))."'.".
+                    " Please use the following pattern for the tag: 'INTEGER_[minutes|hours|days|weeks|months]'".
                     " Aborted message: $msg", 1);
             $out_msg = "<xml>".
                 "<header>answer</header><source>$main::server_address</source><target>GOSA</target>".
@@ -300,41 +294,6 @@ sub process_job_msg {
                 "</xml>";
             return ($out_msg);
         }
-
-        if (exists $msg_hash->{$periodic})   # Check periodical time tag and set value
-        {
-            if (ref $msg_hash->{$periodic}[0] eq "HASH")   # Periodical time tag is empty
-            {
-                &main::daemon_log("$session_id ERROR: Message contains no content of periodical time tag.".
-                        " Please use an integer for this tag (i. e.: <periodic>hours</periodoc><hours>5</hours>)", 1);
-                $out_msg = "<xml>".
-                    "<header>answer</header><source>$main::server_address</source><target>GOSA</target>".
-                    "<answer1>1</answer1><error_string>Message contains no content of periodic time tag</error_string>".
-                    "</xml>";
-                return ($out_msg);
-
-            }
-
-            if (not $msg_hash->{$periodic}[0] =~ /[1-9]+\d*/)   # Periodical time tag is not an INT > 0
-            {
-                &main::daemon_log("$session_id ERROR: Message contains invalid periodical time tag '$msg_hash->{$periodic}[0]'.".
-                        " Please use an integer for this tag (i. e.: <periodic>hours</periodoc><hours>5</hours>)", 1);
-                $out_msg = "<xml>".
-                    "<header>answer</header><source>$main::server_address</source><target>GOSA</target>".
-                    "<answer1>1</answer1><error_string>Message contains invalid periodic time tag '$msg_hash->{$periodic}[0]'</error_string>".
-                    "</xml>";
-                return ($out_msg);
-            }
-
-            $periodic_time = $msg_hash->{$periodic}[0];
-        }
-    }
-
-    # Default db value is 'none' otherwise use systax /\d+_$periodic/
-    my $db_periodic_value = 'none';
-    if ($periodic ne 'none')
-    {
-        $db_periodic_value = $periodic_time."_".$periodic;
     }
 
     # Add job to job queue
@@ -352,7 +311,7 @@ sub process_job_msg {
                        plainname=>$plain_name,
             siserver=>"localhost",
             modified=>"1",
-            periodic=>$db_periodic_value,
+            periodic=>$periodic,
         };
         my $res = $main::job_db->add_dbentry($func_dic);
         if (not $res == 0) {
index 4c16e6cef856412386e6bb204cf06035a89dd64a..3e0ff53de11abd1b95a899d55fd3b02d985f7c8d 100755 (executable)
@@ -19,7 +19,7 @@ for($count = 1; $count <= $zahl; $count++)
        # Funktioniert noch nicht
        #$data = "<xml><header>gosa_opsi_test</header><source>GOSA</source><target>00:01:6C:9D:B9:FA</target><productId>acroread</productId></xml>";
 
-       $data = "<xml><header>gosa_opsi_getLicenseInformationForProduct</header><source>GOSA</source><target>00:01:6C:9D:B9:FA</target><productId>acroread</productId></xml>";
+       #$data = "<xml><header>gosa_opsi_getLicenseInformationForProduct</header><source>GOSA</source><target>00:01:6C:9D:B9:FA</target><productId>acroread</productId></xml>";
 
        #$data = "<xml><header>gosa_opsi_getLicensePools_listOfHashes</header><source>GOSA</source><target>00:01:6C:9D:B9:FA</target></xml>";
 
@@ -46,7 +46,7 @@ for($count = 1; $count <= $zahl; $count++)
 
        ##############################
        # periodical jobs
-       #$data = "<xml><header>job_trigger_action_reboot</header><source>GOSA</source><target>00:0c:29:4c:4b:0c</target><macaddress>00:0c:29:4c:4b:0c</macaddress><timestamp>20090629000000</timestamp><periodic>weeks</periodic><weeks>2</weeks></xml>"; 
+       #$data = "<xml><header>job_trigger_action_reboot</header><source>GOSA</source><target>00:0c:29:4c:4b:0c</target><macaddress>00:0c:29:4c:4b:0c</macaddress><timestamp>23450629000000</timestamp><periodic>3_months</periodic></xml>"; 
        #$data = "<xml><header>job_trigger_action_reboot</header><source>GOSA</source><target>00:0c:29:4c:4b:0c</target><timestamp>20090626135000</timestamp><macaddress>00:0c:29:4c:4b:0c</macaddress><periodic>minutes</periodic><minutes>5</minutes></xml>";
     /* Prepare a hunge bunch of data to be send */
     # jobdb add
@@ -64,7 +64,7 @@ for($count = 1; $count <= $zahl; $count++)
     #$data = "<xml> <header>gosa_trigger_reload_ldap_config</header> <source>GOSA</source><target>00:0C:29:4C:4B:0C</target></xml>";
 
     # jobdb update  
-    #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source> <target>GOSA</target> <where><clause><phrase> <id>1</id></phrase></clause></where> <update><timestamp>19700101000000</timestamp></update></xml>";
+    #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source> <target>GOSA</target> <where><clause><phrase> <id>1</id></phrase></clause></where> <update><periodic>12_weeks</periodic></update></xml>";
     #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <macaddress>00:01:6c:9d:b9:fa</macaddress></phrase></clause> </where> <update><status>processing</status> <result>update</result></update></xml>";
 
     # jobdb query