kaltura / platform-install-packages

Official deployment packages to install the Kaltura platform on a server or cluster environments using native OS package managers
GNU Affero General Public License v3.0
520 stars 241 forks source link

create_remote_storage.php cannot start a session for a partner #511

Closed wzur closed 8 years ago

wzur commented 8 years ago

Hi @jessp01

Based on issue #333 I wanted to automate creation of content delivery profile and storage profile. However when I tried to use "create_remote_storage.php" from kaltura-postinst-1.0.30-10.noarch it didn't work for me. We have Kaltura CE 11.5.0.

I can only see this in logs

2016-01-29 14:55:34 [0.000955] [10.74.10.65] [1385664611] [16] [API] [kSessionUtils::startKSession] INFO: Checking partner '101' with Secret 'c31exxxxxxxxxxxxxxxxxxaaa' 2016-01-29 14:55:34 [0.000600] [10.74.10.65] [1385664611] [17] [API] [KalturaFrontController->getExceptionObject] ERR: exception 'KalturaAPIException' with message 'Error while starting session for partner [101]' in /opt/kaltura/app/api_v3/services/SessionService.php:51 Stack trace:

0 [internal function]: SessionService->startAction('c31ed2a8c633cdd...', '', 2, 101, 86400, '')

The first entry ('Checking...') I added myself to find out what was going on.

It looks to me that code tries to authenticate as a partner for which profiles should be created, but with admin console admin_secret.

Please advise, Waldemar

jessp01 commented 8 years ago

Hi @wzur,

The script requires the admin secret of partner -2, not of the partner you wish to create the remote storage for. This is because such an action must be done by the admin console partner [-2]. So, you need to pass along the partner ID you wish to create it for, probably 101 in your case, but the admin secret for -2, usage also states that: Usage:/opt/kaltura/bin/create_remote_storage.php ...

Let me know if after doing so you're still having issues.

Thanks,

wzur commented 8 years ago

Hi Jess,

That was exactly how I executed that script, with partner ID (101 indeed) and partner -2 secret and for some reason Kaltura server tried authenticate partner 101 with partner -2 secret.

Waldemar

On 5 February 2016 at 11:32, Jess Portnoy notifications@github.com wrote:

Hi @wzur https://github.com/wzur,

The script requires the admin secret of partner -2, not of the partner you wish to create the remote storage for. This is because such an action must be done by the admin console partner [-2]. So, you need to pass along the partner ID you wish to create it for, probably 101 in your case, but the admin secret for -2, usage also states that: Usage:/opt/kaltura/bin/create_remote_storage.php ...

Let me know if after doing so you're still having issues.

Thanks,

— Reply to this email directly or view it on GitHub https://github.com/kaltura/platform-install-packages/issues/511#issuecomment-180308426 .

jessp01 commented 8 years ago

Hi Waldemar,

Looking at the trace you attached, I see: SessionService->startAction('c31ed2a8c633cdd...', '', 2, 101, 86400, '')

but the script never tries to do a session->start() with any partner other than -2, at least not the version I'm looking at:

grep start /opt/kaltura/bin/create_remote_storage.php

    $ks = $client->session->start($secret, null, KalturaSessionType::ADMIN, -2, null,null);

Which is also what's available from https://github.com/kaltura/platform-install-packages/blob/Kajam-11.8.0/RPM/scripts/postinst/create_remote_storage.php

So, I think it is possible that this log entry you're seeing is unrelated.. In your version of the script, do you see any other call to session->start()?

wzur commented 8 years ago

I'm using exactly the same script. Below are results of the execution. I'm 100% I'm using correct admin's admin secret - I've just copy and pasted it from MySQL database. (using select admin_secret from partner where id = -2;)

$ php /opt/kaltura/bin/create_remote_storage.php https://video.rhythmone.com 101 50****996 CDN https://****t.com storagehost /basedir remoteuser remote password HTTP HTTP

object(KalturaException)#89 (8) {
  ["arguments":"KalturaException":private]=>
  array(1) {
    ["PID"]=>
    int(101)
  }
  ["message":protected]=>
  string(46) "Error while starting session for partner [101]"
  ["string":"Exception":private]=>
  string(0) ""
  ["code":protected]=>
  string(19) "START_SESSION_ERROR"
  ["file":protected]=>
  string(62) "/opt/kaltura/web/content/clientlibs/php5/KalturaClientBase.php"
  ["line":protected]=>
  int(894)
  ["trace":"Exception":private]=>
  array(2) {
    [0]=>
    array(6) {
      ["file"]=>
      string(58) "/opt/kaltura/web/content/clientlibs/php5/KalturaClient.php"
      ["line"]=>
      int(6730)
      ["function"]=>
      string(21) "throwExceptionIfError"
      ["class"]=>
      string(17) "KalturaClientBase"
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(1) {
        [0]=>
        array(4) {
          ["code"]=>
          string(19) "START_SESSION_ERROR"
          ["message"]=>
          string(46) "Error while starting session for partner [101]"
          ["objectType"]=>
          string(19) "KalturaAPIException"
          ["args"]=>
          array(1) {
            ["PID"]=>
            int(101)
          }
        }
      }
    }
    [1]=>
    array(6) {
      ["file"]=>
      string(42) "/opt/kaltura/bin/create_remote_storage.php"
      ["line"]=>
      int(59)
      ["function"]=>
      string(5) "start"
      ["class"]=>
      string(21) "KalturaSessionService"
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(6) {
        [0]=>
        string(32) 50****996
        [1]=>
        NULL
        [2]=>
        int(2)
        [3]=>
        int(-2)
        [4]=>
        NULL
        [5]=>
        NULL
      }
    }
  }
  ["previous":"Exception":private]=>
  NULL
}
KalturaCommunity-zz commented 8 years ago

Yep. I am able to reproduce it. Have not run this script for a while.. give me a few minutes to look into:)

May the source be with you,

Jess Portnoy

Kaltura Connect Virtual Summits 2015 - now on VOD! [connect.mediaspace.kaltura.com]

On Fri, 5 Feb 2016, wzur wrote:

I'm using exactly the same script. Below are results of the execution. I'm 100% I'm using correct admin's admin secret - I've just copy and pasted it from MySQL database. (using select admin_secret from partner where id = -2;)

$ php /opt/kaltura/bin/create_remote_storage.php https://video.rhythmone.com 101 50_996 CDN https://_t.com storagehost /based ir remoteuser remote password HTTP HTTP

object(KalturaException)#89 (8) { ["arguments":"KalturaException":private]=> array(1) { ["PID"]=> int(101) } ["message":protected]=> string(46) "Error while starting session for partner [101]" ["string":"Exception":private]=> string(0) "" ["code":protected]=> string(19) "START_SESSION_ERROR" ["file":protected]=> string(62) "/opt/kaltura/web/content/clientlibs/php5/KalturaClientBase.php" ["line":protected]=> int(894) ["trace":"Exception":private]=> array(2) { [0]=> array(6) { ["file"]=> string(58) "/opt/kaltura/web/content/clientlibs/php5/KalturaClient.php" ["line"]=> int(6730) ["function"]=> string(21) "throwExceptionIfError" ["class"]=> string(17) "KalturaClientBase" ["type"]=> string(2) "->" ["args"]=> array(1) { [0]=> array(4) { ["code"]=> string(19) "START_SESSION_ERROR" ["message"]=> string(46) "Error while starting session for partner [101]" ["objectType"]=> string(19) "KalturaAPIException" ["args"]=> array(1) { ["PID"]=> int(101) } } } } [1]=> array(6) { ["file"]=> string(42) "/opt/kaltura/bin/create_remote_storage.php" ["line"]=> int(59) ["function"]=> string(5) "start" ["class"]=> string(21) "KalturaSessionService" ["type"]=> string(2) "->" ["args"]=> array(6) { [0]=> string(32) 50****996 [1]=> NULL [2]=> int(2) [3]=> int(-2) [4]=> NULL [5]=> NULL } } } ["previous":"Exception":private]=> NULL }

— Reply to this email directly or view it on GitHub.[ACH7XoMkDwB8S4MRRPWWeoetxCOKFhGqks5phI3XgaJpZM4HPRDO.gif]

jessp01 commented 8 years ago

Fixed. Please see: https://github.com/kaltura/platform-install-packages/commit/72020d49ce30dffa4683a4d7853f983b3f8b852f

Thanks for reporting it.

wzur commented 8 years ago

That worked for me, many thanks

jessp01 commented 8 years ago

Great:)