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

[config:import:single] not works #3223

Closed
igasi opened this issue Mar 10, 2017 · 15 comments
Closed

[config:import:single] not works #3223

igasi opened this issue Mar 10, 2017 · 15 comments

Comments

@igasi
Copy link
Contributor

igasi commented Mar 10, 2017

Problem/Motivation

I was running the command drupal config:import:single config.name --file=path/to/config.name.yml and I got the message

 // config:import:single
 
 [OK] Configuration(s) "", has been imported successfully.                                                                                                                                                                    

Apparently, the configuration has been imported, but

  • The information about the config.name not appears.
  • Importing or overwriting the configuration was not performed

Details to include:

  • Why are we doing this? Above all, a summary should explain why a change is needed, in a few short sentences.

How to reproduce

  1. Prepare a config drupal yml file valid. e.g. system.site.yml (you can export from drupal)
  2. Modify some value into the system.site.yml
  3. Run
drupal config:import:single system.site --file=path/to/system.site.yml

Details to include:

  • Drupal version
    Drupal 8.3.0-rc1
  • Console version
drupal/console                        1.0.0-rc16         The Drupal CLI. A tool to generate boilerplate code, interact with and...
drupal/console-core                   1.0.0-rc16         Drupal Console Core
drupal/console-en                     1.0.0-rc16         Drupal Console English Language
drupal/console-extend-plugin          0.4.0              Drupal Console Extend Plugin

  • Console Launcher version
Drupal Console version 1.0.0-rc16

Solution

Ensure that

igasi added a commit to igasi/DrupalConsole that referenced this issue Mar 10, 2017
igasi added a commit to igasi/DrupalConsole that referenced this issue Mar 10, 2017
igasi added a commit to igasi/DrupalConsole that referenced this issue Mar 10, 2017
jmolivas pushed a commit that referenced this issue Mar 15, 2017
* issue #2131 Removed config.factory service extra in generate:form command

* #3223 Fixed config:import:single

* #3223 Fixed config:import:single - improved validation
@jmolivas
Copy link
Member

Fixed with #3224

Thanks @igasi

@csandanov
Copy link

csandanov commented Apr 18, 2017

When I execute

$ drupal -vvv cis --name "search_api.server.solr_6_4" --file search-api-solr-server.yml

I get [ERROR] Value can not be empty, worked fine before with the stable version. Is this the same issue? Using RC-16 version of console. Should I use dev-master to fix it?

@csandanov
Copy link

After upgrading to dev-master the command stopped working at all:

$ drupal cis --help
ArgumentCountError: Too few arguments to function Drupal\Console\Command\Generate\CommandCommand::__construct(), 4 passed and exactly 5 expected in /var/www/html/vendor/drupal/console/src/Command/Generate/CommandCommand.php on line 68 #0 [internal function]: Drupal\Console\Command\Generate\CommandCommand->__construct(Object(Drupal\Console\Generator\CommandGenerator), Object(Drupal\Console\Extension\Manager), Object(Drupal\Console\Utils\Validator), Object(Drupal\Console\Core\Utils\StringConverter))
#1 phar:///usr/local/bin/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php(928): ReflectionClass->newInstanceArgs(Array)
#2 phar:///usr/local/bin/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php(468): Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(Symfony\Component\DependencyInjection\Definition), 'console.generat...')
#3 /var/www/html/vendor/drupal/console/src/Application.php(170): Symfony\Component\DependencyInjection\ContainerBuilder->get('console.generat...')
#4 /var/www/html/vendor/drupal/console/src/Application.php(41): Drupal\Console\Application->registerCommands()
#5 phar:///usr/local/bin/drupal/vendor/symfony/console/Application.php(122): Drupal\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/html/vendor/drupal/console/bin/drupal.php(68): Symfony\Component\Console\Application->run()
#7 phar:///usr/local/bin/drupal/src/Utils/Launcher.php(30): include_once('/var/www/html/v...')
#8 phar:///usr/local/bin/drupal/bin/drupal.php(86): Drupal\Console\Launcher\Utils\Launcher->launch('/var/www/html', Object(Composer\Autoload\ClassLoader))
#9 phar:///usr/local/bin/drupal/bin/drupal(3): require('phar:///usr/loc...')
#10 /usr/local/bin/drupal(10): require('phar:///usr/loc...')
#11 {main}
ArgumentCountError: Too few arguments to function Drupal\Console\Command\Generate\CommandCommand::__construct(), 4 passed and exactly 5 expected in Drupal\Console\Command\Generate\CommandCommand->__construct() (line 68 of /var/www/html/vendor/drupal/console/src/Command/Generate/CommandCommand.php).

@jmolivas
Copy link
Member

@csandanov can you try rebuild caches drupal cr all

@csandanov
Copy link

@jmolivas didn't help

@jmolivas
Copy link
Member

@csandanov I will try and ping you back

@csandanov
Copy link

@jmolivas thank you, you can reproduce the error by running Drupal 8 tests from docker4drupal project, just uncomment the tests and run make test drupal=8 php=7.1 from the repository root. The image with Drupal code (installed via composer template) is wodby/drupal:8-7.1

@ultimike
Copy link
Contributor

ultimike commented Jul 1, 2017

I am seeing this exact same behavior with 1.0.0-rc20.

depanthconfig_ -bash _120x48_and_local_development_and_notes

@jmolivas
Copy link
Member

jmolivas commented Jul 1, 2017

@ultimike @csandanov The config:import:single command file option is expecting a full file path

drupal-config-import-single

Same for inline mode

drupal config:import:single  \
--name="block.block.default_block" \
--file="/Users/jmolivas/Desktop/block.block.default_block.yml"

drupal-config-import-single-2

@jmolivas
Copy link
Member

jmolivas commented Jul 1, 2017

@ultimike @csandanov @igasi I think we can use only file option and remove name since we can obtain name from file ie:

/Users/jmolivas/Desktop/block.block.default_block.yml => block.block.default_block

@jmolivas jmolivas changed the title config:import:single not works [config:import:single] not works Jul 2, 2017
@jmolivas
Copy link
Member

jmolivas commented Jul 2, 2017

I did some changes on the command removing the name option PR #3369 and could be used like:

Interactive mode:

drupal config:import:single 

drupal-config-import-single-3

Providing a file option using full path

drupal config:import:single \
--file="/Users/jmolivas/Desktop/block.block.default_block.yml"

Providing file and directory options

drupal config:import:single  \
--file="block.block.default_block.yml" \
--directory="/Users/jmolivas/Desktop/"

drupal-config-import-single-4

@ultimike
Copy link
Contributor

ultimike commented Jul 3, 2017

Excellent - thanks!

-mike

@bartvanhoutte
Copy link

bartvanhoutte commented Nov 29, 2017

FYI, the --file option does not work with home directories (~):

ie: ~/releases/release-x/config/sync/some.config.yml

You need to provide the path without ~ :

ie: /home/userx/releases/release-x/config/sync/some.config.yml

This probably has something to do with tildes not being expanded by PHP's realpath: http://php.net/manual/en/function.realpath.php#121577.

@hughworm
Copy link

I ran into this in Drupal Console version 1.8.0. Using a path relative to the current directory gave this error. Changing the path of --directory to be relative to the Drupal root made it work.

@msshaylaj
Copy link

Hi there,
Wondering if there's a way to import multiple config files in one command. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants