Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container error using templates from different sites #18780

Closed
bryanboza opened this issue Jun 25, 2020 · 15 comments
Closed

Container error using templates from different sites #18780

bryanboza opened this issue Jun 25, 2020 · 15 comments

Comments

@bryanboza
Copy link
Member

bryanboza commented Jun 25, 2020

We have problems when you use a file-based container and templates from different sites, we have a NotFoundInDbException and we are unable to edit the page.

To recreate:

  • Login as admin
  • Create a new site
  • Add a new page on this site (using the default template)
  • Open the page and try to edit to add some piece of content

Stacktrace

ST: https://gist.github.com/bryanboza/9eccb75cd8c597cf1542e58a1212dd5e

image

Expected

We need be able to support that case since is a common use case

Testing info:

Tested on release-5.3.3 // Postgres // FF

Fix: The fix was use always absolute path into the page's layout, the relative path only will be allow in advance template and it should be resolve using the current host.
Also was created a Task Upgrate to change all the relative path in not advance template into absolute path.
Also a Job was created to change all the host's name in the absolute path when the host's name was changed in edit content

@bryanboza bryanboza added this to the Bug Sprint milestone Jun 25, 2020
@jcastro-dotcms
Copy link
Contributor

As @bryanboza said, this is a very common use case. Please treat this ticket as high priority

@fmontes
Copy link
Member

fmontes commented Jun 25, 2020

Next release based on this conversation: https://dotcms.slack.com/archives/CE1TBQU00/p1593122028046400

@freddyucv freddyucv self-assigned this Jul 22, 2020
freddyucv pushed a commit that referenced this issue Jul 24, 2020
dsilvam pushed a commit that referenced this issue Jul 27, 2020
* #18571 Testing

* Update Reltionship_cache_in_push_publish.postman_collection.json

* Update Reltionship_cache_in_push_publish.postman_collection.json

* Update Reltionship_cache_in_push_publish.postman_collection.json

* Update Reltionship_cache_in_push_publish.postman_collection.json

* #18780 Testing

* #18571 bundle files
@dsilvam
Copy link
Contributor

dsilvam commented Jul 27, 2020

PR: #18935

@freddyucv
Copy link

freddyucv commented Aug 10, 2020

Note to QA:

Tested:
Before run TaskUpgrade

  • Running the Task05380ChangeContainerPathToAbsolute Task upgrade with the end point

POST  http://localhost:8080/api/v1/upgradetask {
    			"upgradeTaskClass":"com.dotmarketing.startup.runonce.Task05380ChangeContainerPathToAbsolute"
			}

the follow statement was run in the data base before and after the task upgrade

select count(*) from template where drawed_body LIKE '%demo.dotcms.com%’,

the result before the tsk upgrade was 0, after was 82.

  • Create a new empty site, create a page and create a new template, add a file container in another site, run the upgrade task and check the template in database should point to the another site
  • Create a page in the new site with a template in another site, go to layout and change layout, run the upgrade task and check the container path in data base

After run first the TaskUpgrade and flush cache

  • A new page was created, add a File Container from another site into the layout, and check in data base if the path is absolute.

  • A new page was created, add a File Container from same site into the layout, and check in data base if the path is absolute.

  • Created a new template in the Template manager and add a File Container from the same site into it, check in data base if the path is absolute.

  • Created a new template in the Template manager and add a File Container from another site into it, check in data base if the path is absolute.

  • Created a new Template in the Template Manager, add a Container (any type), add a slide bar and add the same Container into it, check if the UUID are sequencials, Later edit the template and add the same container one more time the UUID should be 3.

  • A new page was created, Add a FileContainer (in the same site) into the Layout, copy the site checking the copy container check, and check that in the site the page is linked with the container in the new site and not with the container in the original site.

  • A new page was created, Add a FileContainer (in the same site) into the Layout, copy the site unchecking the copy container check, and check that in the site the page is linked with the container in the original site.

    • Copied demo.dotcms.com, and create a new site named new_site_1, created a new page in new_site_1, and add a FileContainer from the demo.dotcms.com, copy the new_site_1 (created a new site named new_site_2), checking the copy containers check, Cheking that the containers in the new page in linked with the containers in demo.dotcms.com
  • Change the host's name, in any host and check that the all the page are working

  • Create a new advanced template with a relative path, add this template to a new page, it should work in resolve the relative path in the current host, copy the site checking the copy containers check, the container in the new page should be resolve with the container in the new site.

  • Repeat the test before but copy the site unchecking the copy containers check, the container in the new page should be resolve with the container in the default site. (This is correctly resolved at Edite Page level but not at REST Page API containers)

  • Created a new page add content into it, and rename the host, the page should has the content after the host's name.

  • Copy demo.dotcms.com in the full starter and check the index page in the new site, should use the File containers in the new site

  • Copy the demo.dotcms.com site and create demo_2 site, checking the copy containers check, later copy teh demo_2 site and create a new demo_3 site checking the copy containers check again, check that the containers path in the Template Layout has the demo_3

freddyucv pushed a commit that referenced this issue Aug 12, 2020
@wezell
Copy link
Contributor

wezell commented Aug 12, 2020

Container resolution strategy

  1. If the container exists on the //host referenced host, use it
  2. if no //host, try current host
  3. If not there, try the default host

@wezell
Copy link
Contributor

wezell commented Aug 12, 2020

Also, we need to show the host next to the container in the layout screen.

freddyucv pushed a commit that referenced this issue Aug 24, 2020
@freddyucv
Copy link

@dsilvam dsilvam self-assigned this Sep 14, 2020
@dsilvam
Copy link
Contributor

dsilvam commented Sep 14, 2020

Passed Internal QA: Failing case mentioned above is now working.

@dsilvam dsilvam removed their assignment Sep 14, 2020
freddyucv pushed a commit that referenced this issue Sep 21, 2020
dsilvam pushed a commit that referenced this issue Sep 25, 2020
* #16796 adding fixes and comments to support the jwt on pp

* #16796 Fixing error when some parameters not come in the request

* #16796 Testing

* #16796 refactoring/testing

* #16796 testing

* #16796 refactorign

* #16796 Refactoring

* Revert "#16796 refactoring/testing"

This reverts commit d06b4af.

* refactoring

* #16796 Fixing Test

* #16796 Fixing PP error

* #16796 Sending JWT token in PP request

* #16796 Removing receiver configuration from jsp

* #18690 Using JWT token in integrity checker

* #16796 Show invalid token message when IC fails with a invalid token

* #16796 Removing end poitn id from fix conflicts end point

* #16796 Adding Task Upgrade

* #16796 Not show token when it is invalid or expired

* #16796 Allow switch between old way token and JWT token in Push Publish

* #16796 Allow switch between old way token and JWT token in Push Publish

* #16796 Postman Testing

* #16796 Postman Testing

* #16796 Testing

* #16796

* #16796 testing

* #16796 undo change

* Revert "#16796 undo change"

This reverts commit b1c4fc2.

* #16796 undo change

* #16796 undo change

* #16796 undo change

* #16796 undo change

* Adding doc

* #16796 Refactoring

* refactoring

* Revert "refactoring"

This reverts commit d949dcc.

* #16796 Using PP ols way as fallback

* #18780 Fixing Push publish fallback

* Fixing test

* fixing test

* Testing

* fixing test

* Fixing test

* fixing test

* fixing test

* Fixing testing

* fixing testing

* Fixing integration test

* Fixing test

* Fix testing

* Fixing test

* Fixing testing

* Fixing test

* #16796: Chaging Quartz 'isJobRunning' implementation

* Fixing testing

* Fixing test

* Testing

* Java doc

Co-authored-by: jdotcms <jonathan.sanchez@dotcms.com>
Co-authored-by: Victor Alfaro <victor.alfaro@dotcms.com>
@bryanboza
Copy link
Member Author

bryanboza commented Sep 29, 2020

@dsilvam
Copy link
Contributor

dsilvam commented Oct 6, 2020

Passed Internal QA: Failures reported by @bryanboza on the last comment are working as expected

@bryanboza
Copy link
Member Author

Fixed, tested on release-5.3.9. // Postgres // FF

@wezell wezell closed this as completed Oct 8, 2020
dsilvam added a commit that referenced this issue Nov 4, 2020
* Update dotcmsReleaseVersion and coreWebReleasion version

* update release version

* #18505 JSONTool does not return sub arrays

* #18505 now the JSONTool uses the Jackson to map the string json as a single Maps and Lists

* #18505 now the JSONTool uses the Jackson to map the string json as a single Maps and Lists

* #19364 Unable to edit category permissions as limited user even you have full rights

* #18314 Make Query Tool Use fetch() to fill response

* #19098 SAML update logout page.  (#19450)

* include css in jsp

* label updated

* Updating sql files (#19478)

* Updating sql files to remove contraints

* Updating sql files to remove contraints

* #18690 Allow Push publish just for enterprise license in the receiver (#19492)

* #18690 Allow Push publish just for enterprise license in the receiver

* testing

* Fixing test

* Issue 19500 sql injection containers (#19501)

* #18605 pauses and then unpauses based on a cache invalidation

* #18605 adding ttl to the cache put in the logger

* #18605 less logging

* #19500 sanitize sql

* #19500 fixes potential sql vunerabilities

* #19500 writing tests

* #19500 tests

* we should not need TLS set to true

* #19500 removing unneeded files

* #19338 dont lowercase (#19506)

* #19338 dont lowercase

* #19338 integration test

* #19338 missing test resource

* #19509 use proper db columm in query (#19510)

* #19509 use proper db columm in query

* #19509 use proper property from contentlet

* #19509 fix integration test

* #19509 fix integration test

* #19471 Use proper value when discarding conflicts (#19519)

* #18780 fixes job when new hostname starts with  original hostname (#19522)

* #19509 Fixing bug when use comma in host's name (#19528)

* #19509 Fixing bug when use comma in host's name

* Fixing test

* update core-web version

* merge with master

* Update .gitmodules

* Update gradle.properties

Co-authored-by: Jonathan <jonathan.sanchez@dotcms.com>
Co-authored-by: erickgonzalez <erick.gonzalez@dotcms.com>
Co-authored-by: hmoreras <31667212+hmoreras@users.noreply.github.com>
Co-authored-by: Freddy Rodriguez <freddy0309@gmail.com>
Co-authored-by: Will Ezell <will@dotcms.com>
@john-thomas-dotcms john-thomas-dotcms added the LTS : Next Ticket that will be added to LTS label Oct 5, 2021
@ian-b-cooper
Copy link

ian-b-cooper commented Oct 5, 2021

This is seen here https://dotcms.zendesk.com/agent/tickets/105352 as a current customer issue

@swicken-dotcms swicken-dotcms added LTS: Excluded Ticket that has been excluded from at least one LTS Severity : Support Requested and removed LTS : Next Ticket that will be added to LTS labels Nov 22, 2021
@swicken-dotcms
Copy link
Contributor

This will not be backported to 5.3.8.X as the changes are too extensive

victoralfaro-dotcms referenced this issue May 18, 2022
* dotCMS#18780 Show host name in container selector

* dotCMS#18780 rollback

* dotCMS#18780 testing
victoralfaro-dotcms referenced this issue May 18, 2022
* progress

* progress

* event handler tests

* test update

* model import

* feedback

* Issue 18780 show host name in container selector (#1419)

* dotCMS#18780 Show host name in container selector

* dotCMS#18780 rollback

* dotCMS#18780 testing

* progress

* progress working before clean up

* cleanup before tests

* test update

* clean up

* support other evetns in dot-workflow-task

* Update dotcms-models

* Update package-lock

Co-authored-by: Freddy Rodriguez <freddy0309@gmail.com>
Co-authored-by: GH Pages Bot <hello@ghbot.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants