Magento2: CLI won't work without write permissions

Created on 22 Dec 2016  路  10Comments  路  Source: magento/magento2

I'm so tired of this cr*p.

Why do you still enforce that the CLI must have write permissions to certain directories. There is more than one workflow to deploy magento and not all require/allow to change code on a production server.

Please remove this "feature" or make it optional by app/etc/env.php

Preconditions

mage 2.1.2

Steps to reproduce

  1. remove write permission to var/generation
  2. try to run any cli command

Expected result

  1. the cli command runs

Actual result

  1. "Command line user does not have read and write permissions on var/generation directory."

Comments/Thoughts

We compile all code locally and then deploy it but we're are forced to run the indexer and a custom upgrade command for module updates. Nothing is supposed to change code in production, nothing. Not a cli command not the webserver process. The code is static and only changed by the deployment process.

Please consider making this check optional or remove it or downgrade it to a warning.

Setup Ready for Work bug report

Most helpful comment

Hi @misha-kotov

A backport to 2.1.x has not been created at this time.

So, could you please reopen the task and mark it as up for grabs so that someone could notice it a do a backport? Otherwise the closest "one of the upcoming releases" which will include this fix will be 2.2.0, which is still a long way from being stable.

Having the task closed gives a false impression that bugfix is already available to the wide public in one of the already released versions. Which is not the case, obviously.

All 10 comments

Hi @ludwig-gramberg

Which mode do you use?
Read-only environment may be used only in production mode.
Other modes are generating classes on-the-fly.

production mode.
just look at the cli class, its hard coded to check wether or not the directories are writeable

vendor/magento/framework/Console/Cli.php

    /**
     * @param string $name  application name
     * @param string $version application version
     * @SuppressWarnings(PHPMD.ExitExpression)
     */
    public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
    {
        $this->serviceManager = \Zend\Mvc\Application::init(require BP . '/setup/config/application.config.php')
            ->getServiceManager();

        $generationDirectoryAccess = new GenerationDirectoryAccess($this->serviceManager);
        if (!$generationDirectoryAccess->check()) {
            $output = new ConsoleOutput();
            $output->writeln(
                '<error>Command line user does not have read and write permissions on var/generation directory.  Please'
                . ' address this issue before using Magento command line.</error>'
            );
            exit(0);
        }

Hi @ludwig-gramberg

Thanks for the update.
We've created internal ticket MAGETWO-62655 to investigate and fix this issue.

Assigning @misha-kotov to look into this.

The issue has been fixed and will be included in one of the upcoming releases.

This issue was fixed for develop branch.
Closed.

Hi @veloraven,
Is there a backport planned for this issue?

still present in 2.1.7 :'-(

A backport to 2.1.x has not been created at this time.

Hi @misha-kotov

A backport to 2.1.x has not been created at this time.

So, could you please reopen the task and mark it as up for grabs so that someone could notice it a do a backport? Otherwise the closest "one of the upcoming releases" which will include this fix will be 2.2.0, which is still a long way from being stable.

Having the task closed gives a false impression that bugfix is already available to the wide public in one of the already released versions. Which is not the case, obviously.

Was this page helpful?
0 / 5 - 0 ratings