I've created JIRA https://issues.jboss.org/browse/KEYCLOAK-1789 and have a fix, which will be available for 1.5.0 version. As a workaround, you can add ids to the realms in JSON file. In that case, it will import both realms. Like this:

[ {
  "id"  : "Test1",

  "realm" : "Test1",

   -----

}, {
  "id": "Test2",

  "realm" : "Test2",

   -----

}]

Marek

On 01/09/15 10:23, Nangunoori, Srinivas wrote:

Quick Update:

I just updated with latest master (Today’s code base). Still I am seeing the same issue.

 

-Srini

 

From: Nangunoori, Srinivas
Sent: Tuesday, September 01, 2015 1:33 PM
To: 'Marek Posolda'; keycloak-user@lists.jboss.org
Subject: RE: [keycloak-user] Query regarding import multiple realms through single json file

 

Thanks for the quick reply.

I am using 1.5.0 with August 7th code base.

 

Please find attached json file which I am using for import realms.

 

-Srini

 

From: Marek Posolda [mailto:mposolda@redhat.com]
Sent: Tuesday, September 01, 2015 1:19 PM
To: Nangunoori, Srinivas; keycloak-user@lists.jboss.org
Subject: Re: [keycloak-user] Query regarding import multiple realms through single json file

 

Could you send me the JSON with your rep? I will try in my environment. Btv. which keycloak version are you using?

Thanks,
Marek

On 01/09/15 09:37, Nangunoori, Srinivas wrote:

There are no errors in server logs,

 

07:32:58,073 INFO  [org.keycloak.exportimport.singlefile.SingleFileImportProvider] (ServerService Thread Pool -- 62) Full importing from file /opt/jboss/keycloak/paas.json

07:33:01,517 INFO  [org.keycloak.exportimport.util.ImportUtils] (ServerService Thread Pool -- 62) Realm 'Test2' imported

07:33:01,531 INFO  [org.keycloak.exportimport.ExportImportManager] (ServerService Thread Pool -- 62) Import finished successfully

 

Test2 is last realm entry in my paas.json file. Here Test1 was not imported.

 

JSON has following entries.,

[ {

  "realm" : "Test1",

   -----

}, {

  "realm" : "Test2",

   -----

}]

 

-Srini

 

From: Marek Posolda [mailto:mposolda@redhat.com]
Sent: Monday, August 31, 2015 8:30 PM
To: Nangunoori, Srinivas; keycloak-user@lists.jboss.org
Subject: Re: [keycloak-user] Query regarding import multiple realms through single json file

 

Is there something in server log when you start the server? Especially look at logged lines from "ExportImportManager" and "ImportUtils" categories.

Could you also try to use absolute path for the file (just for sure?). You used "paas.json", but later you mentioned "pass.json", but I believe this is just typo in email rather than bad file path?

Marek

On 31/08/15 15:16, Nangunoori, Srinivas wrote:

Hi Experts,

 

I am trying to import multiple relams info through single json file using following command, here pass.json has multiple realm info. But, only last realm is getting imported in keycloak

 

bin/standalone.sh -c standalone-ha.xml -b=<server name> -bmanagement=<server name> -Djboss.node.name=<server name> -Dkeycloak.migration.action=import -Dkeycloak.migration.provider=singleFile -Dkeycloak.migration.file=paas.json

 

Here pass.json has multiple realm info. But, only last realm is getting imported in keycloak.

 

JSON has info.,

[

{

  "realm" : "Test1",

   -----

},

 

{

  "realm" : "Test2",

   -----

}

]

 

In this case, always “Test2” is getting imported not the “Test1”.

 

Regards,

Srini

 

 

 




_______________________________________________
keycloak-user mailing list
keycloak-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user