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

Please add administrator user as optional parameter to bin/magento setup:upgrade #1671

Closed
nagno opened this issue Aug 13, 2015 · 16 comments
Closed
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@nagno
Copy link

nagno commented Aug 13, 2015

Hello!

We tried to create a cms page from setup script and it seems, there is no clean way to do it with the merchant beta version.
The issue is caused by the observer in the VersionsCms module. The new CMS page is always going to be handled like a version controlled CMS page (https://github.com/magento/magento2ee/blob/f37c9d7bea3ff2300dc38f2e426f0f447b6c4c4d/app/code/Magento/VersionsCms/Model/Backend/Observer.php#L274) and it requires a logged in admin user (https://github.com/magento/magento2ee/blob/f37c9d7bea3ff2300dc38f2e426f0f447b6c4c4d/app/code/Magento/VersionsCms/Model/Backend/Observer.php#L291)

It would be a lot easier to implement these kind of setup scripts, if we have an admin user loaded by default.

Could you please consider to add the optional parameter for the administrator username like the sample data installer works at the moment?

Thanks!

@mbrinton01
Copy link

@nagno it is possible to specify an admin username during CLI install: http://devdocs.magento.com/guides/v2.0/install-gde/install/cli/install-cli-install.html

Is this what you are referring to?

@nagno
Copy link
Author

nagno commented Aug 13, 2015

Hi @mbrinton01,
nope, I'm referring to the bin/magento setup:upgrade command (as it is in the title of the issue).
Unfortunately it doesn't have the admin user option:

bin/magento help setup:upgrade
Usage:
 setup:upgrade [--magento-init-params="..."]

Options:
 --magento-init-params  Add to any command to customize Magento initialization parameters
                        For example: "MAGE_MODE=developer&MAGE_DIRS[base][path]=/var/www/example.com&MAGE_DIRS[cache][path]=/var/tmp/cache"
 --help (-h)            Display this help message
 --quiet (-q)           Do not output any message
 --verbose (-v|vv|vvv)  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)         Display this application version
 --ansi                 Force ANSI output
 --no-ansi              Disable ANSI output
 --no-interaction (-n)  Do not ask any interactive question

@mazhalai
Copy link
Contributor

@nagno Thank you for reporting this issue, we have created MAGETWO-41500 to track this internally.

@mazhalai mazhalai added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development PS labels Aug 13, 2015
@nagno
Copy link
Author

nagno commented Aug 13, 2015

Thanks!

@BaDos
Copy link
Contributor

BaDos commented Sep 30, 2015

Hello, @nagno!

How did you create a CMS page?
You can see the sample code to create page in the next file: https://github.com/magento/magento2/blob/develop/app/code/Magento/Cms/Setup/InstallData.php

I created a simple module and added creation of CMS page in setup script.
Ran bin/magento setup:upgrade
New module was installed and new CMS page was created.

@nagno
Copy link
Author

nagno commented Oct 1, 2015

Hi @BaDos,
I would like to highlight, we are using the merchant beta version (beta 3), not the simple beta version. Have you tried with that?
The simple beta version doesn't have the VersionCms module, which causes the issue.

We have a code like this:

$page = $this->pageFactory->create()->load($pageData['identifier'], 'identifier');
if (!$page->getId()) {
    $page->setIdentifier($pageData['identifier']);
}
$page->setTitle($pageData['title']);
$page->setPageLayout($pageData['page_layout']);
$page->setMetaKeywords($pageData['meta_keywords']);
$page->setMetaDescription($pageData['meta_description']);
$page->setContentHeading($pageData['content_heading']);
$page->setContent($pageData['content']);
$page->setIsActive($pageData['is_active']);
$page->setStores($pageData['stores']);
$page->setSortOrder($pageData['sort_order']);
$page->save();

@nagno
Copy link
Author

nagno commented Oct 1, 2015

I think, this issue was reported before we started to log the issues to the partner portal. Do you want me to report it on the partner portal instead of github?

@piotrekkaminski
Copy link
Contributor

@nagno do you still have this issue in the latest version?

@nagno
Copy link
Author

nagno commented Oct 8, 2015

Hi @piotrekkaminski,
Could you please let me know, why did you close the ticket?

@adragus-inviqa
Copy link
Contributor

@piotrekkaminski - I can confirm the issue on the merchant beta 5 version.
Can you guys re-open this?
You cannot add pages from setup scripts with the VersionCms enabled.

@nagno
Copy link
Author

nagno commented Oct 29, 2015

I opened a partner portal ticket (#02570269), probably that will help to get support on it.

@piotrekkaminski I'm really sad it was closed without any explanation. :(
I know the Magento developers are really busy during these days (so am I) but closing tickets without really investigating them is not a good idea. For everybody's sake please don't continue this practice or we will end up with a product full of bugs.

@jamescowie
Copy link

Re opened the issue for more clarification. @nagno @adragus-inviqa can you confirm if you are still having issues ? @mazhalai Can you share the status of the internal ticket please ?

@jamescowie jamescowie reopened this Nov 27, 2015
@nagno
Copy link
Author

nagno commented Nov 27, 2015

I tried to reproduce it one time, but I wasn't successful with a single setup script, however I'm quite sure the issue is there. I think, it is happening when you have multiple scripts and they somehow causes this issue. Also it might be from upgrade script. We had the issue on our project, where we had many setup scripts.
I have to spend a little bit more time on it to find a clear instruction set to reproduce it, but recently I was too busy and I will be in the next 2-3 weeks. @adragus-inviqa: if you have some time, I'm happy if you can add the steps to reproduce it on a vanilla environment.

@mazhalai
Copy link
Contributor

@nagno any update on this?

@nagno
Copy link
Author

nagno commented Jan 3, 2016

Hi @mazhalai
I was heavily working on it in the last 2 days and finally I just successfully reproduced it (after ~4.5 months it is not easy to roll back a project to a specific state to reproduce an issue). I'm quite sure it is related to a previous setup script state, but unfortunately I just ran out of my free time again and I'm won't have time investigate it further in the next few weeks. :( I'm just about to send the entire project code to your support team via partner portal with the instructions to reproduce it.

-- UPDATE --
I tested it with merchant_beta 9.

@mazhalai
Copy link
Contributor

mazhalai commented Jan 4, 2016

@nagno That sounds like a plan. Closing this issue, since it will be handled via partner portal

@mazhalai mazhalai closed this as completed Jan 4, 2016
magento-team pushed a commit that referenced this issue Nov 7, 2017
[EngCom] Public Pull Requests - 2.2-develop
 - MAGETWO-83279: Magento 2.2.0 Solution for Cross-sell product placeholder image size … #12018
 - MAGETWO-83270: 11700: "Something Went Wrong" error for limited access admin user #11993
 - MAGETWO-83085: fix #8846: avoid duplicated attribute option values #11785
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

7 participants