goodhosts / vagrant

Vagrant plugin that use goodhosts to manipulate hosts files
https://rubygems.org/gems/vagrant-goodhosts/
MIT License
17 stars 8 forks source link

Error provisioning on fresh install when installing vagrant-goodhosts plugin #45

Closed juanmaguitar closed 3 years ago

juanmaguitar commented 3 years ago

What was The Command Used To Provision

vagrant up

What Kind of VVV Provision Was This

This was a fresh install

Logs/What Broke

This is the sequence of commands I've executed

(base) ⬢  ~  git clone -b stable https://github.com/Varying-Vagrant-Vagrants/VVV.git ~/vvv-local
Cloning into '/Users/juanma/vvv-local'...
remote: Enumerating objects: 15589, done.
remote: Counting objects: 100% (1320/1320), done.
remote: Compressing objects: 100% (683/683), done.
remote: Total 15589 (delta 841), reused 960 (delta 600), pack-reused 14269
Receiving objects: 100% (15589/15589), 8.79 MiB | 9.82 MiB/s, done.
Resolving deltas: 100% (8153/8153), done.
(base) ⬢  ~  cd vvv-local
(base) ⬢  vvv-local  stable ⦾ vagrant up
__ __ __ __
\ V\ V\ V / v3.7.2 Path:"/Users/juanma/vvv-local"
 \_/\_/\_/  git::stable(92758fd)

Copying config/default-config.yml to config/config.yml
IMPORTANT NOTE: Make all modifications to config/config.yml in future so that they are not lost when VVV updates.

Platform: darwin19.2.0 shell:/bin/zsh vagrant-hostmanager shared_db_folder_disabled
Vagrant: v2.2.7, virtualbox: v6.1.22

Docs:       https://varyingvagrantvagrants.org/
Contribute: https://github.com/varying-vagrant-vagrants/vvv
Dashboard:  http://vvv.test

 X ! There is no hosts file vagrant plugin installed!
 X You need the vagrant-goodhosts plugin (or HostManager/ HostsUpdater ) for domains to work in the browser
 X Run 'vagrant plugin install --local' to fix this.

Vagrant has detected project local plugins configured for this
project which are not installed.

  vagrant-goodhosts
Install local plugins (Y/N) [N]: Y
Installing the 'vagrant-goodhosts' plugin. This can take a few minutes...
Fetching: os-1.1.1.gem (100%)
Fetching: vagrant-goodhosts-1.1.0.gem (100%)
Installed the plugin 'vagrant-goodhosts (1.1.0)'!

Vagrant has completed installing local plugins for the current Vagrant
project directory. Please run the requested command again.
(base) ⬢  vvv-local  stable ⦾ vagrant up
Vagrant failed to initialize at a very early stage:

The plugins failed to load properly. The error message given is
shown below.

/Users/juanma/vvv-local/.vagrant/plugins/gems/2.4.9/gems/vagrant-goodhosts-1.1.0/lib/vagrant-goodhosts/GoodHosts.rb:104: syntax error, unexpected keyword_rescue, expecting keyword_end
        rescue StandardError => _e
              ^
/Users/juanma/vvv-local/.vagrant/plugins/gems/2.4.9/gems/vagrant-goodhosts-1.1.0/lib/vagrant-goodhosts/GoodHosts.rb:255: syntax error, unexpected keyword_end, expecting end-of-input
(base) ⬢  vvv-local  stable ⦾ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]

This is the content of my config/config.yml

---

# This file is a YAML formatted file. YAML indenting is done in spaces not
# tabs, and whitespace is significant. If you don't stick to this, it will
# fail on provision

#
# IMPORTANT, if you change this file, you have to reprovision,  no exceptions
# Do this by running either this command:
# vagrant reload --provision

# Or, if your machine is already turned on:
# vagrant provision
#

# These are your websites, and their names map on to the folders they're
# located in. See the docs for how to define these, and what all the keys
# and options are
sites:

  # latest version of WordPress, can be used for client work and testing
  # Check the readme at https://github.com/Varying-Vagrant-Vagrants/custom-site-template
  wordpress-one:
    skip_provisioning: false
    description: "A standard WP install, useful for building plugins, testing things, etc"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    hosts:
      - one.wordpress.test
    custom:
      wpconfig_constants:
        WP_DEBUG: true
        WP_DEBUG_LOG: true
        WP_DISABLE_FATAL_ERROR_HANDLER: true # To disable in WP 5.2 the FER mode

  wordpress-two:
    skip_provisioning: false
    description: "A standard WP install, useful for building plugins, testing things, etc"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    custom:
      # locale: it_IT
      delete_default_plugins: true
      install_plugins:
        - query-monitor
    hosts:
      - two.wordpress.test

  # The following commented out site configuration will create a standard WordPress
  # site in www/example-site/ available at http://mysite.test.
  # Remember, whitespace is significant! Tabs and spaces mean different things
  #mysite:
  #  description: "My website"
  #  repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
  #  hosts:
  #    - mysite.test

  # The wordpress-develop configuration is useful for contributing to WordPress Core.
  # It uses the built WP to serve the site
  wordpress-trunk:
    skip_provisioning: true # provisioning this one takes longer, so it's disabled by default
    description: "An svn based WP Core trunk dev setup, useful for contributor days, Trac tickets, patches"
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template-develop.git
    hosts:
      - trunk.wordpress.test

  # The following commented out site configuration will create a environment useful
  # for contributions to the WordPress meta team, .e.g WordCamps, .org, etc:
  wordpress-meta-environment:
    skip_provisioning: true # disabled by default, this takes a long time to provision
    description: "An environment useful for contributions to the WordPress meta team."
    repo: https://github.com/WordPress/meta-environment.git
    hosts:
      - wp-meta.test
    custom:
      provision_site:
        "buddypressorg.test": true
        "jobs.wordpressnet.test": true
        "wordcamp.test": true
        "wordpressorg.test": true
        "wordpresstv.test": true

  # The following commented out site configuration will create a standard WordPress
  # site in www/example-site/ available at http://my-example-site.test.
  # Remember, whitespace is significant! Tabs and spaces mean different things
  #example-site:
  #  repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
  #  hosts:
  #    - my-example-site.test

# Utilities https://varyingvagrantvagrants.org/docs/en-US/utilities/
# are system level items that aren't websites, that install tools or packages
# the core utilities install tools such as phpmyadmin
utilities:
  core: # The core VVV utility
    - tls-ca # HTTPS SSL/TLS certificates
    - phpmyadmin # Web based database client
    #- memcached-admin # Object cache management
    #- opcache-status # opcache management
    #- webgrind # PHP Debugging
    #- mongodb # needed for Tideways/XHGui
    #- tideways # PHP profiling tool, also installs xhgui check https://varyingvagrantvagrants.org/docs/en-US/references/tideways-xhgui/
    #- nvm # Node Version Manager
    #- php56
    #- php70
    #- php71
    #- php72
    #- php73
    #- php74

# vm_config controls how Vagrant provisions the virtual machine, and can be used to
# increase the memory given to VVV and the number of CPU cores.
# It can also be used to override the default provider being used within Vagrant.

vm_config:
  # For WP core development we recommend at least 2GB ( 2048 ),
  # If you have 4GB of RAM, lower this to 768MB or you may encounter issues
  memory: 2048
  # CPU cores:
  cores: 2

  # this tells VVV to use the prebuilt box copied from the USB drive at contributor days
  # once set to false, do not change back to true, and reprovision
  # wordcamp_contributor_day_box: false

  # Due to a limitation within Vagrant, the specified provider is only respected on a clean `vagrant up`
  # as Vagrant currently restricts you to one provider per machine
  # https://www.vagrantup.com/docs/providers/basic_usage.html#vagrant-up
  # provider: virtualbox
  # provider: hyperv
  # provider: parallels
  # provider: vmware_desktop

# General VVV options
general:

  # Back up Options
  # You can always backup/restore manually using vagrant ssh -c "db_backup" or vagrant ssh -c "db_restore"

  # Backup the databases to the database/backups subfolder on halt/suspend/destroy, set to false to disable
  db_backup:
      enable: false
      gzip: true
      #exclude:
      #  - wordpress-trunk

  # Import the databases if they're missing from backups
  db_restore: false

  # set to true to use a synced shared folder for MariaDB database storage
  db_share_type: false

  # GitHub token to use from composer
  #github_token: xxxxxx

# Settings for the vagrant plugins supported by VVV
vagrant-plugins:
  disksize: 10GB # requires the disk size vagrant plugin

Possible Solution

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Your Environment

__ __ __ __
\ V\ V\ V / v3.7.2 Path:"/Users/juanma/vvv-local"
 \_/\_/\_/  git::stable(92758fd)

Related to https://github.com/Varying-Vagrant-Vagrants/VVV/issues/2542

juanmaguitar commented 3 years ago

As a hint, even when I have a Ruby version higher than 2.5

(base) ⬢  vvv-local  stable ⦾ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]

It seems to install the plugin for a 2.4.9 version → /Users/juanma/vvv-local/.vagrant/plugins/gems/2.4.9/gems/vagrant-goodhosts-1.1.0/lib/vagrant-goodhosts/

(base) ⬢  vvv-local  stable ⦾ vagrant up
Vagrant failed to initialize at a very early stage:

The plugins failed to load properly. The error message given is
shown below.

/Users/juanma/vvv-local/.vagrant/plugins/gems/2.4.9/gems/vagrant-goodhosts-1.1.0/lib/vagrant-goodhosts/GoodHosts.rb:104: syntax error, unexpected keyword_rescue, expecting keyword_end
        rescue StandardError => _e
              ^
/Users/juanma/vvv-local/.vagrant/plugins/gems/2.4.9/gems/vagrant-goodhosts-1.1.0/lib/vagrant-goodhosts/GoodHosts.rb:255: syntax error, unexpected keyword_end, expecting end-of-input
Mte90 commented 3 years ago

You are using an old Ruby version. This package require at least ruby 2.5, I did that change so the next release will have this constraint.

So you need to update ruby on your machine to be able to use this plugin (I will wait some days before to do a new release).

juanmaguitar commented 3 years ago

You are using an old Ruby version. This package require at least ruby 2.5, I did that change so the next release will have this constraint. So you need to update ruby on your machine to be able to use this plugin (I will wait some days before to do a new release).

Thanks, @Mte90 Actually, It seemed to be more of an issue with the vagrant version.

After updating both to the latest version., now it works properly 👍

(base) ⬢  vvv-local  stable ⦾ ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin20]
(base) ⬢  vvv-local  stable ⦾ vagrant -v
Vagrant 2.2.18

I'm closing this issue