Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

prepare hypernode-vagrant for php7.1 on Xenial #184

Merged
merged 7 commits into from
Feb 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require 'fileutils'

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
VAGRANT_HYPCONFIGMGMT_VERSION = "0.0.9"
VAGRANT_HYPCONFIGMGMT_VERSION = "0.0.10"

# if vagrant-hypconfigmgmt is not installed, install it and abort
if !Vagrant.has_plugin?("vagrant-hypconfigmgmt", version = VAGRANT_HYPCONFIGMGMT_VERSION) && !ARGV.include?("plugin") && !ARGV.include?("status")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from hypernode_vagrant_runner.log import setup_logging
from hypernode_vagrant_runner.runner import launch_runner
from hypernode_vagrant_runner.settings import HYPERNODE_VAGRANT_PHP_VERSIONS, HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION, \
HYPERNODE_VAGRANT_DEFAULT_USER, HYPERNODE_VAGRANT_USERS, UPLOAD_PATH
HYPERNODE_VAGRANT_DEFAULT_USER, HYPERNODE_VAGRANT_USERS, UPLOAD_PATH, PRECISE_UNAVAILABLE_PHP


def parse_arguments(parser):
Expand Down Expand Up @@ -86,10 +86,10 @@ def parse_start_runner_arguments():
help='Run "vagrant up" with the --no-provision flag'
)
args = parse_arguments(parser)
if not args.xenial and args.php == '5.6':
if not args.xenial and args.php in PRECISE_UNAVAILABLE_PHP:
parser.error(
"Can't use the Precise Hypernode with PHP5.6. "
"Add the --xenial flag to use the Xenial version"
"Can't use the Precise Hypernode with PHP{}. "
"Add the --xenial flag to use the Xenial version".format(args.php)
)
return args

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PRECISE_UNAVAILABLE_PHP = ['5.6', '7.1']
HYPERNODE_VAGRANT_REPOSITORY = 'https://github.com/byteinternet/hypernode-vagrant'
REQUIRED_VAGRANT_PLUGINS = [
'vagrant-vbguest',
Expand All @@ -6,7 +7,8 @@
HYPERNODE_VAGRANT_PHP_VERSIONS = [
'5.5',
'5.6',
'7.0'
'7.0',
'7.1'
]
HYPERNODE_VAGRANT_BOX_NAMES = {
'5.5': 'hypernode_php5',
Expand All @@ -28,8 +30,7 @@
'vagrant'
]

# Use the last available PHP version as the default
HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION = HYPERNODE_VAGRANT_PHP_VERSIONS[-1]
HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION = '7.0'

HYPERNODE_VAGRANT_CONFIGURATION = """
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def write_hypernode_vagrant_configuration(
directory,
php_version=HYPERNODE_VAGRANT_DEFAULT_PHP_VERSION,
xdebug_enabled=False,
xenial=False
xenial=True
):
"""
Write the hypernode-vagrant local.yml configuration file to the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ def test_parse_start_runner_arguments_errors_when_php56_and_precise(self):

self.argument_parser.return_value.error.assert_called_once_with(ANY)

def test_parse_start_runner_arguments_errors_when_php71_and_precise(self):
self.parse_arguments.return_value.php = '7.1'
self.parse_arguments.return_value.xenial = False

parse_start_runner_arguments()

self.argument_parser.return_value.error.assert_called_once_with(ANY)

def test_parse_start_runner_arguments_does_not_error_when_php55_and_precise(self):
self.parse_arguments.return_value.php = '5.5'
self.parse_arguments.return_value.xenial = False
Expand All @@ -170,3 +178,10 @@ def test_parse_start_runner_arguments_does_not_error_if_php56_and_xenial(self):
parse_start_runner_arguments()

self.assertFalse(self.argument_parser.return_value.error.called)

def test_parse_start_runner_arguments_does_not_error_if_php71_and_xenial(self):
self.parse_arguments.return_value.php = '7.1'

parse_start_runner_arguments()

self.assertFalse(self.argument_parser.return_value.error.called)
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def tearDown(self):
rmtree(self.temp_dir, ignore_errors=True)

def test_write_hypernode_vagrant_configuration_writes_configuration(self):
write_hypernode_vagrant_configuration(self.temp_dir)
write_hypernode_vagrant_configuration(self.temp_dir, xenial=False)

with open(self.temp_config_file) as f:
ret = f.read()
Expand All @@ -36,7 +36,7 @@ def test_write_hypernode_vagrant_configuration_writes_configuration(self):
self.assertEqual(ret, expected_configuration)

def test_write_hypernode_vagrant_configuration_writes_config_with_specified_php_version(self):
write_hypernode_vagrant_configuration(self.temp_dir, php_version='5.5')
write_hypernode_vagrant_configuration(self.temp_dir, php_version='5.5', xenial=False)

with open(self.temp_config_file) as f:
ret = f.read()
Expand All @@ -54,7 +54,7 @@ def test_write_hypernode_vagrant_configuration_writes_config_with_specified_php_
self.assertEqual(ret, expected_configuration)

def test_write_hypernode_vagrant_configuration_writes_config_with_xdebug_enabled_if_specified(self):
write_hypernode_vagrant_configuration(self.temp_dir, xdebug_enabled=True)
write_hypernode_vagrant_configuration(self.temp_dir, xdebug_enabled=True, xenial=False)

with open(self.temp_config_file) as f:
ret = f.read()
Expand Down Expand Up @@ -84,3 +84,19 @@ def test_write_hypernode_vagrant_configuration_writes_writes_config_with_xenial_
ubuntu_version='xenial'
)
self.assertEqual(ret, expected_configuration)

def test_write_hypernode_vagrant_configuration_writes_config_with_specified_xenial_exclusive_php_version(self):
write_hypernode_vagrant_configuration(self.temp_dir, php_version='7.1')
# PHP 7.1 is not available in the Ubuntu Precise hypernode-vagrant

with open(self.temp_config_file) as f:
ret = f.read()
expected_configuration = HYPERNODE_VAGRANT_CONFIGURATION.format(
xdebug_enabled='false',
php_version='7.1',
box_name=HYPERNODE_XENIAL_BOX_NAME,
box_url=HYPERNODE_XENIAL_URL,
ubuntu_version='xenial'
)
self.assertEqual(ret, expected_configuration)

2 changes: 1 addition & 1 deletion vagrant/plugins/vagrant-hypconfigmgmt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ all:
test:
bundle exec rspec spec/
install:
find pkg/ -name '*.gem' | tail -n 1 | xargs vagrant plugin install
find pkg/ -name '*.gem' | sort -nr | tail -n 1 | xargs vagrant plugin install
clean:
git clean -xfd

30 changes: 29 additions & 1 deletion vagrant/plugins/vagrant-hypconfigmgmt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,33 @@ Create the gemfile (package)
```
$ make
rake build
vagrant-hypconfigmgmt 0.0.8 built to pkg/vagrant-hypconfigmgmt-0.0.9.gem.
vagrant-hypconfigmgmt 0.0.10 built to pkg/vagrant-hypconfigmgmt-0.0.10.gem.
```

Installing a locally developed hypconfigmgmt
============================================

1. Bump the version to one later than the latest version

Edit `Vagrantfile` and update `VAGRANT_HYPCONFIGMGMT_VERSION`

Edit `vagrant/plugins/vagrant-hypconfigmgmt/README.md` and update the version there.

Edit `vagrant/plugins/vagrant-hypconfigmgmt/lib/vagrant-hypconfigmgmt/version.rb` and update `VERSION`.

2. Navigate to `vagrant/plugins/vagrant-hypconfigmgmt` and run `make && make install`


Deploying a new vagrant-hypconfigmgmt
=====================================

1. Only for Byte staff members.

2. Do the above, except the `make install` is not necessary

3. Remove the previous latest gem from `vagrant/plugins/vagrant-hypconfigmgmt/pkg` so only your new version remains.

4. Commit into your branch, make a PR, merge after review.

5. Publish the new gem with `gem push vagrant-hypconfigmgmt-0.0.<YOURVERSION>.gem`, see http://guides.rubygems.org/publishing/ for details. Credentials are in the usual place.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
AVAILABLE_MAGENTO_VERSIONS = [1, 2]

DEFAULT_PHP_VERSION = 7.0
AVAILABLE_PHP_VERSIONS = [5.5, 5.6, 7.0]
AVAILABLE_PHP_VERSIONS = [5.5, 5.6, 7.0, 7.1]

DEFAULT_VARNISH_STATE = false
AVAILABLE_VARNISH_STATES = [true, false]
Expand Down Expand Up @@ -292,8 +292,8 @@ def ensure_vagrant_box_type_configured(env)
settings['vagrant']['box'] = 'hypernode_xenial'
settings['vagrant']['box_url'] = 'http://vagrant.hypernode.com/customer/xenial/catalog.json'
else
if settings['php']['version'] == 5.6
env[:ui].warning("The Precise Hypernodes don't have PHP5.6. Falling back to 5.5. Use the Xenial version of this box if you want PHP5.6")
if [5.6, 7.1].include? settings['php']['version']
env[:ui].warning("The Precise Hypernodes don't have PHP#{settings['php']['version']}. Falling back to 5.5. Use the Xenial version of this box if you want PHP#{settings['php']['version']}")
settings['php']['version'] = 5.5
end
case settings['php']['version']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

module Vagrant
module Hypconfigmgmt
VERSION = "0.0.9"
VERSION = "0.0.10"
end
end
Binary file not shown.
Binary file not shown.
Loading