welaika / wordmove

Multi-stage command line deploy/mirroring and task runner for Wordpress
https://wptools.it/wordmove
MIT License
1.87k stars 165 forks source link

error with wordmove pull -d #603

Closed byron222 closed 2 years ago

byron222 commented 4 years ago

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:inparse' /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 commented 4 years ago

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 commented 4 years ago

Trying to involve @maiorano84 and @nlemoine .

I've found some more scenarios related to this issue and probaly related to https://github.com/welaika/wordmove/pull/597

`load_from_yml': undefined method `with_indifferent_access' for false:FalseClass (NoMethodError)
`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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

That's not just a ruby's parser problem: https://p195.p4.n0.cdn.getcloudapp.com/items/nOueWKe6/Image%202020-06-11%20at%206.41.55%20PM.png?v=5fa4a2d55ea2d1ea7af6b628f49a2c9b

nlemoine commented 4 years ago

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 commented 4 years ago

Other traces from wp-cli repo: https://github.com/wp-cli/wp-cli/issues/4982

Thanks @nlemoine for the feedback :)

alessandro-fazzi commented 4 years ago

@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 commented 4 years ago

@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 commented 2 years ago

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 :)