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

error with wordmove pull -d #603

Closed
byron222 opened this issue Jun 4, 2020 · 11 comments
Closed

error with wordmove pull -d #603

byron222 opened this issue Jun 4, 2020 · 11 comments

Comments

@byron222
Copy link

byron222 commented Jun 4, 2020

i got the next error when I pull my database

from /root/.rbenv/versions/2.6.0/lib/ruby/2.6.0/json/common.rb:156:in parse'
/root/.rbenv/versions/2.6.0/lib/ruby/2.6.0/json/common.rb:156:in parse': 767: unexpected token at '' (JSON::ParserError)

@alessandro-fazzi
Copy link
Member

Hi @byron222 ,

the only thing I can reply is that "it works on my machine".

Why didn't you have used the bug reporting issue template? I'd have had much more informations to try to understand your problem. Would you mind to update your issue description?

Aside of that: is the command wp cli param-dump --with-values working correctly in your shell from within the project?

@alessandro-fazzi
Copy link
Member

alessandro-fazzi commented Jun 11, 2020

Trying to involve @maiorano84 and @nlemoine .

I've found some more scenarios related to this issue and probaly related to #597

  • if a wp-cli.yml does exist but it's empty:
`load_from_yml': undefined method `with_indifferent_access' for false:FalseClass (NoMethodError)
  • if the wp-cli.yml file starts with a @ symbol:
`parse': (/Users/fuzzy/dev/sistemi_prodotti/wp-cli.yml): found character that cannot start any token while scanning for the next token at line 1 column 1 (Psych::SyntaxError)

@byron222 do you feel like your problem could be related to the existence of a wp-cli.yml file in your project?

@alessandro-fazzi
Copy link
Member

Reproducing the second error reported by me in irb:

> irb
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> YAML.load('test: false')
=> {"test"=>false}
irb(main):003:0> YAML.load('@test: false')
Traceback (most recent call last):
        8: from /Users/fuzzy/.rbenv/versions/2.6.5/bin/irb:23:in `<main>'
        7: from /Users/fuzzy/.rbenv/versions/2.6.5/bin/irb:23:in `load'
        6: from /Users/fuzzy/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
        5: from (irb):3
        4: from /Users/fuzzy/.rbenv/versions/2.6.5/lib/ruby/2.6.0/psych.rb:277:in `load'
        3: from /Users/fuzzy/.rbenv/versions/2.6.5/lib/ruby/2.6.0/psych.rb:390:in `parse'
        2: from /Users/fuzzy/.rbenv/versions/2.6.5/lib/ruby/2.6.0/psych.rb:456:in `parse_stream'
        1: from /Users/fuzzy/.rbenv/versions/2.6.5/lib/ruby/2.6.0/psych.rb:456:in `parse'
Psych::SyntaxError ((<unknown>): found character that cannot start any token while scanning for the next token at line 1 column 1)

@alessandro-fazzi
Copy link
Member

Also with a real file adding the @ in front of staging only before the second call

irb(main):004:0> YAML.load(File.read('wp-cli.yml'))
=> {"staging"=>{"ssh"=>"xxx", "path"=>"/var/www/xxx", "disabled_commands"=>["db drop", "db search-replace"]}}
irb(main):005:0> YAML.load(File.read('wp-cli.yml'))
Traceback (most recent call last):
        8: from /Users/fuzzy/.rbenv/versions/2.6.5/bin/irb:23:in `<main>'
        7: from /Users/fuzzy/.rbenv/versions/2.6.5/bin/irb:23:in `load'
        6: from /Users/fuzzy/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
        5: from (irb):5
        4: from /Users/fuzzy/.rbenv/versions/2.6.5/lib/ruby/2.6.0/psych.rb:277:in `load'
        3: from /Users/fuzzy/.rbenv/versions/2.6.5/lib/ruby/2.6.0/psych.rb:390:in `parse'
        2: from /Users/fuzzy/.rbenv/versions/2.6.5/lib/ruby/2.6.0/psych.rb:456:in `parse_stream'
        1: from /Users/fuzzy/.rbenv/versions/2.6.5/lib/ruby/2.6.0/psych.rb:456:in `parse'
Psych::SyntaxError ((<unknown>): found character that cannot start any token while scanning for the next token at line 1 column 1)

@alessandro-fazzi
Copy link
Member

alessandro-fazzi commented Jun 11, 2020

Having

'@staging':
  ssh: xxxx
  path: /var/www/xxx

  disabled_commands:
  - db drop
  - db search-replace

will get parsed. So the @ seems to be a real issue. I was totally unaware of this.

@alessandro-fazzi
Copy link
Member

@nlemoine
Copy link
Contributor

Hi @pioneerskies

Sorry, I forgot to mention it but indeed, the @ character causes yaml parsing to fail. I'm usually in a rush and comment it to quickly solve the issue.

I don't know well enough the yaml standard. However, Symfony also adds a note about special characters: https://symfony.com/doc/current/components/yaml/yaml_format.html#strings

@alessandro-fazzi
Copy link
Member

Other traces from wp-cli repo: wp-cli/wp-cli#4982

Thanks @nlemoine for the feedback :)

@alessandro-fazzi
Copy link
Member

@nlemoine FYI quoting the key is completely valid YAML and it seems to me it's working for both wp-cli and for ruby parser

@maiorano84
Copy link
Contributor

@byron222 You need to provide more information in order for us to reasonably be able to help you, otherwise we're just guessing as to what your actual problem is. @pioneerskies had a very comprehensive bug report template that you opted to ignore, but despite that he's already narrowed it down to some possibilities given the limited information we have.

Please include the contents of your wp-cli.yml file if you have one, as well as anything else you might have tried or think might be relevant.

@alessandro-fazzi
Copy link
Member

Said that I'm going to close, I'd like to report that from version 6 (currenlty in alpha) JSON::ParserError during wp-cli config exploration will be rescued and wordmove will fall back to it's own configuration from the movefile.yml.

Ciao ciao :)

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

4 participants