vagrant-service-manager 1.0.2 → 1.1.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- module Vagrant
1
+ module VagrantPlugins
2
2
  module ServiceManager
3
3
  class Kubernetes
4
4
  def initialize(machine, ui)
@@ -1,4 +1,4 @@
1
- module Vagrant
1
+ module VagrantPlugins
2
2
  module ServiceManager
3
3
  class OpenShift
4
4
  OPENSHIFT_PORT = 8443
@@ -11,7 +11,7 @@ module Vagrant
11
11
 
12
12
  def execute
13
13
  command = "#{@extra_cmd} sccli openshift"
14
- Plugin.execute_and_exit_on_fail(@machine, @ui, command)
14
+ PluginUtil.execute_and_exit_on_fail(@machine, @ui, command)
15
15
  end
16
16
 
17
17
  def self.status(machine, ui, service)
@@ -33,6 +33,8 @@ module Vagrant
33
33
  end
34
34
 
35
35
  def self.print_info(ui, options)
36
+ PluginLogger.debug("script_readable: #{options[:script_readable] || false}")
37
+
36
38
  label = PluginUtil.env_label(options[:script_readable])
37
39
  message = I18n.t("servicemanager.commands.env.openshift.#{label}",
38
40
  openshift_url: options[:url],
@@ -1,5 +1,5 @@
1
- module Vagrant
1
+ module VagrantPlugins
2
2
  module ServiceManager
3
- VERSION = "1.0.2"
3
+ VERSION = "1.1.0.beta.1"
4
4
  end
5
5
  end
@@ -8,7 +8,7 @@ require 'vagrant-service-manager/plugin'
8
8
  require 'vagrant-service-manager/command'
9
9
  require 'vagrant-service-manager/os'
10
10
 
11
- module Vagrant
11
+ module VagrantPlugins
12
12
  module ServiceManager
13
13
  # Returns the path to the source of this plugin
14
14
  def self.source_root
data/locales/en.yml CHANGED
@@ -24,7 +24,9 @@ en:
24
24
  Commands:
25
25
  env displays connection information for services in the box
26
26
  box displays box related information like version, release, IP etc
27
- restart restarts the given systemd service in the box
27
+ restart restarts the given service in the box
28
+ start starts the given service in the box
29
+ stop stops the given service in the box
28
30
  status list services and their running state
29
31
 
30
32
  Options:
@@ -54,6 +56,10 @@ en:
54
56
  --script-readable display information in a script readable format
55
57
  -h, --help print this help
56
58
 
59
+ Examples:
60
+ vagrant service-manager box version
61
+ vagrant service-manager box ip
62
+ vagrant service-manager box version --script-readable
57
63
  status: |-
58
64
  Usage: vagrant service-manager status [service] [options]
59
65
 
@@ -63,25 +69,22 @@ en:
63
69
  If a service is provided, only that service is reported.
64
70
  If no service is provided only supported orchestrators are reported.
65
71
 
66
- Examples:
67
- vagrant service-manager box version
68
- vagrant service-manager box ip
69
- vagrant service-manager box version --script-readable
70
-
71
- restart: |-
72
- Restarts the service
72
+ Example:
73
+ vagrant service-manager status openshift
74
+ operation: |-
75
+ %{operation}s the service
73
76
 
74
- Usage: vagrant service-manager restart <service> [options]
77
+ Usage: vagrant service-manager %{operation} <service> [options]
75
78
 
76
79
  Service:
77
- A service provided by sccli or systemd. For example:
78
- docker, k8s, or openshift etc.
80
+ A service provided by sccli. For example:
81
+ docker, kubernetes, openshift etc
79
82
 
80
83
  Options:
81
84
  -h, --help print this help
82
85
 
83
86
  Examples:
84
- vagrant service-manager restart docker
87
+ vagrant service-manager %{operation} docker
85
88
 
86
89
  env:
87
90
  docker:
@@ -138,8 +141,11 @@ en:
138
141
  # eval "$(vagrant service-manager env%{command})"
139
142
  service_not_running: |-
140
143
  # %{name} service is not running in the vagrant box.
141
- restart:
144
+ operation:
142
145
  service_missing: 'Service name missing'
146
+ sccli_only_support: |-
147
+ Only sccli services are supported. For example:
148
+ docker, openshift and kubernetes
143
149
 
144
150
  status:
145
151
  nil: |-
@@ -3,17 +3,19 @@ module VagrantPlugins
3
3
  module Cap
4
4
  class BoxVersion
5
5
  # Prints the version of the vagrant box, parses /etc/os-release for version
6
- def self.box_version(machine, script_readable)
6
+ def self.box_version(machine, options = {})
7
7
  command = "cat #{OS_RELEASE_FILE} | grep VARIANT"
8
+
8
9
  # TODO: execute efficient command to solve this
9
10
  if machine.communicate.test(command) # test if command is exits with code 0
11
+ PluginLogger.debug
10
12
  machine.communicate.execute(command) do |type, data|
11
13
  if type == :stderr
12
14
  @env.ui.error(data)
13
15
  exit 126
14
16
  end
15
17
 
16
- return data.chomp if script_readable
18
+ return data.chomp if options[:script_readable]
17
19
  info = Hash[data.delete('"').split("\n").map { |e| e.split('=') }]
18
20
  return "#{info['VARIANT']} #{info['VARIANT_VERSION']}"
19
21
  end
@@ -6,9 +6,12 @@ module VagrantPlugins
6
6
  # Find the guest IP
7
7
  command = "ip -o -4 addr show up |egrep -v ': docker|: lo' |tail -1 | awk '{print $4}' |cut -f1 -d\/"
8
8
  ip = ''
9
+
10
+ PluginLogger.debug
9
11
  machine.communicate.execute(command) do |type, data|
10
12
  ip << data.chomp if type == :stdout
11
13
  end
14
+
12
15
  ip
13
16
  end
14
17
  end
@@ -1,4 +1,5 @@
1
1
  require 'vagrant'
2
+ require File.expand_path('../../../../', __FILE__) + '/lib/vagrant-service-manager/plugin_logger'
2
3
 
3
4
  module VagrantPlugins
4
5
  OS_RELEASE_FILE = '/etc/os-release'
@@ -3,7 +3,7 @@ require 'vagrant-service-manager/version'
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'vagrant-service-manager'
6
- spec.version = Vagrant::ServiceManager::VERSION
6
+ spec.version = VagrantPlugins::ServiceManager::VERSION
7
7
  spec.license = 'GPL-2.0'
8
8
  spec.homepage = 'https://github.com/projectatomic/vagrant-service-manager'
9
9
  spec.summary = "To provide the user a CLI to configure the ADB/CDK for different use cases and to provide glue between ADB/CDK and the user's developer environment."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-service-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Exelbierd
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-09 00:00:00.000000000 Z
12
+ date: 2016-05-31 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Provides setup information, including environment variables and certificates,
15
15
  required to access services provided by ADB/CDK.
@@ -20,23 +20,33 @@ executables: []
20
20
  extensions: []
21
21
  extra_rdoc_files: []
22
22
  files:
23
+ - ".config/cucumber.yml"
23
24
  - ".gitattributes"
24
25
  - ".gitignore"
25
26
  - CHANGELOG.md
26
- - CONTRIBUTING.md
27
+ - CONTRIBUTING.adoc
27
28
  - Gemfile
28
29
  - LICENSE
29
30
  - MAINTAINERS
30
- - README.md
31
+ - README.adoc
31
32
  - Rakefile
32
33
  - TODO
33
34
  - Vagrantfile
35
+ - features/box-command.feature
36
+ - features/debug-flag.feature
37
+ - features/env-command.feature
38
+ - features/help-command.feature
39
+ - features/openshift.feature
40
+ - features/service-operation.feature
41
+ - features/status-command.feature
42
+ - features/support/env.rb
34
43
  - lib/vagrant-service-manager.rb
35
44
  - lib/vagrant-service-manager/action/setup_network.rb
36
45
  - lib/vagrant-service-manager/command.rb
37
46
  - lib/vagrant-service-manager/config.rb
38
47
  - lib/vagrant-service-manager/os.rb
39
48
  - lib/vagrant-service-manager/plugin.rb
49
+ - lib/vagrant-service-manager/plugin_logger.rb
40
50
  - lib/vagrant-service-manager/plugin_util.rb
41
51
  - lib/vagrant-service-manager/service.rb
42
52
  - lib/vagrant-service-manager/services/docker.rb
@@ -66,9 +76,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
76
  version: '0'
67
77
  required_rubygems_version: !ruby/object:Gem::Requirement
68
78
  requirements:
69
- - - ">="
79
+ - - ">"
70
80
  - !ruby/object:Gem::Version
71
- version: '0'
81
+ version: 1.3.1
72
82
  requirements: []
73
83
  rubyforge_project:
74
84
  rubygems_version: 2.4.8
data/CONTRIBUTING.md DELETED
@@ -1,77 +0,0 @@
1
- # Contributing to vagrant-service-manager Plugin
2
-
3
- The following is a set of guidelines for contributing to the
4
- vagrant-service-manager plugin, which is hosted in the [Project Atomic
5
- Organization](https://github.com/projectatomic) on GitHub.
6
-
7
- These are just guidelines, please use your best judgement and feel free
8
- to propose changes to this document in a pull request.
9
-
10
- At this point, this document is not complete, but as decisions are made on the
11
- [container-tools@redhat.com](https://www.redhat.com/mailman/listinfo/container-tools)
12
- mailing list they will be added to this document.
13
-
14
-
15
- ## Submitting Issues
16
-
17
- You can submit issues with respect to the vagrant-service-manager plugin [here](https://github.com/projectatomic/vagrant-service-manager/issues/new).Make sure you include all the relevant details pertaining the issue.
18
-
19
- Before submitting new issues, it is suggested to check [all existing issues](https://github.com/projectatomic/vagrant-service-manager/issues) in order to avoid duplication.The vagrant-service-manager plugin works closely with the [ADB](https://github.com/projectatomic/adb-atomic-developer-bundle/issues) and the [adb-utils](https://github.com/projectatomic/adb-utils/issues) RPM. You may wish to review the issues in both the repositories as well.
20
-
21
-
22
- ## Submitting Pull Requests
23
-
24
- * All changes will be made by pull request (PR), even from core
25
- committers/maintainers.
26
-
27
- * All changes must include appropriate documentation updates.
28
-
29
- * All changes must include an entry in the [Changelog document](https://github.com/projectatomic/vagrant-service-manager/blob/master/CHANGELOG.md) in the *Unreleased* section describing the change. Your new entry should be the last entry in the *Unreleased* section and should include your GitHub userid.
30
-
31
- * All changes need at least 2 ACKs from maintainers before they will be merged. If
32
- the author of the PR is a maintainer, their submission is considered
33
- to be the first ACK. Therefore, PRs from maintainers only need one
34
- additional ACK.
35
-
36
- By "2 ACKs" we mean that two maintainers must acknowledge that the change
37
- is a good one. The 2<sup>nd</sup> person to ACK the PR should merge the PR with
38
- a comment including their agreement.
39
-
40
-
41
- ## How to Develop/Test
42
-
43
- 1. Install the Atomic Developer Bundle (ADB), as
44
- [documented](https://github.com/projectatomic/adb-atomic-developer-bundle/blob/master/docs/installing.rst)
45
- in the ADB project. Do not start the box yet.
46
-
47
- 2. Fork and clone the vagrant-service-manager repository
48
-
49
- git clone https://github.com/projectatomic/vagrant-service-manager
50
-
51
- 3. Change the directory to vagrant-service-manager `cd vagrant-service-manager`
52
-
53
- 4. Run `bundle install`
54
-
55
- 5. Start the box with `bundle exec vagrant up
56
-
57
- 6. Develop the plugin and test by running `bundle exec vagrant service-manager`
58
-
59
- 7. When you are ready to build the release, get one of the [repository maintainers](https://github.com/projectatomic/vagrant-service-manager/blob/master/MAINTAINERS) to release the plugin.
60
-
61
-
62
- ### How to build the Vagrant plugin using Bundler
63
-
64
- You can also use Bundler to build the plugin and install it manually in
65
- your Vagrant environment
66
-
67
- 1. Run the commands below inside of the repository:
68
-
69
- ```
70
- $ bundle install
71
- $ bundle exec rake build
72
- ````
73
-
74
- 2. Install the plugin using:
75
-
76
- vagrant plugin install pkg/<gem name>
77
-
data/README.md DELETED
@@ -1,120 +0,0 @@
1
- # vagrant-service-manager
2
-
3
- * [Objective](#objective)
4
- * [Example Execution of the Plugin](#example_execution)
5
- * [Available Commands](#commands)
6
- * [Exit codes](#exit_codes)
7
- * [IP Address Detection](#ip_addr)
8
- * [Getting Involved with the Project](#Contributing)
9
- * [Builds](#builds)
10
-
11
-
12
- The vagrant-service-manager plugin is designed to enable easier access to the features and services provided by the [Atomic Developer Bundle (ADB)](https://github.com/projectatomic/adb-atomic-developer-bundle). It provides setup information, including environment variables and certificates, required to access services provided by the ADB and is a must have for most ADB users.
13
-
14
- This plugin makes it easier to use the ADB with host-based tools such as Eclipse and the docker and kubernetes CLI commands. Details on how to use ADB with this plugin can be found in the [ADB Documentation](https://github.com/projectatomic/adb-atomic-developer-bundle/blob/master/docs/using.rst).
15
-
16
-
17
- ## Objective <a name="objective"></a>
18
-
19
- The [ADB](https://github.com/projectatomic/adb-atomic-developer-bundle) provides a ready-to-use development environment for container applications. With ADB, developers can dive right into producing complex, multi-container applications.
20
-
21
- The vagrant-service-manager provides the user with:
22
-
23
- * A CLI to configure the ADB for different use cases and to provide an interface between ADB and the user's development environment.
24
- * A tool to control and configure the ADB from the
25
- developer's workstation without having to `ssh` directly into the ADB virtual machine.
26
-
27
-
28
- ## Example Execution of the Plugin <a name="example_execution"></a>
29
-
30
- 1. Install vagrant-service-manager plugin:
31
-
32
- vagrant plugin install vagrant-service-manager
33
-
34
- 2. Download the relevant Vagrantfile for your [ADB](https://github.com/projectatomic/adb-atomic-developer-bundle) vagrant box, from the [repository](https://github.com/projectatomic/adb-atomic-developer-bundle/tree/master/components/centos). For further details on the usage of custom Vagrantfiles designed for specific use cases, refer to the [Usage Documentation](https://github.com/projectatomic/adb-atomic-developer-bundle/blob/master/docs/using.rst).
35
-
36
- 3. Start the ADB vagrant box using `vagrant up`. For detailed instructions consult the [Installation Documentation](https://github.com/projectatomic/adb-atomic-developer-bundle/blob/master/docs/installing.rst).
37
-
38
- **Note:** When the vagrant-service-manager plugin is loaded and a box is started using the VirtualBox provider, the user needs to add a routable non NAT network interface declaration in the Vagrantfile. If the user does not provide a network declaration in the Vagrantfile, a private DHCP network is added by default and a warning is displayed.
39
-
40
- 4. Run the plugin to get environment variables and certificates:
41
-
42
- $ vagrant service-manager env docker
43
- # Set the following environment variables to enable access to the
44
- # docker daemon running inside of the vagrant virtual machine:
45
- export DOCKER_HOST=tcp://172.28.128.4:2376
46
- export DOCKER_CERT_PATH=/foo/bar/.vagrant/machines/default/virtualbox/docker
47
- export DOCKER_TLS_VERIFY=1
48
- export DOCKER_API_VERSION=1.21
49
- # run following command to configure your shell:
50
- # eval "$(vagrant service-manager env docker)"
51
-
52
- **Note:** The required TLS certificates are copied to the host machine at the time of `vagrant up` itself. Every run of `vagrant service-manager env docker` checks for the validity of the certificates on the host machine by matching the certificates inside the box. If the certificates on the host machine are invalid, this command will also re-download the certificates onto the host machine.
53
-
54
-
55
- ## Available Commands <a name="commands"></a>
56
-
57
- The following section lists the available commands for the plugin and their explanation:
58
-
59
- 1. `vagrant service-manager env [service] [--script-readable]`
60
-
61
- Displays connection information for all active services in the box in a manner that can be evaluated in a shell. If a `service` is specified, only the information for that service is displayed. When `--script-readable` is specified the output is in `key=value` format. The supported services are: Docker; OpenShift.
62
-
63
- 2. `vagrant service-manager box [command]`
64
-
65
- Displays box related information like release version, IP etc.
66
-
67
- 3. `vagrant service-manager box version [--script-readable]`
68
-
69
- Displays the version and release information of the running VM. When `--script-readable` is specified the output is in `key=value` format.
70
-
71
- 4. `vagrant service-manager box ip`
72
-
73
- Displays the routable IP address of the running VM.
74
-
75
- 5. `vagrant service-manager status [service]`
76
-
77
- Lists services and their running state. If a `service` is specified only the status of that service is displayed. If no service is provided then only supported orchestrators are reported.
78
-
79
- 6. `vagrant service-manager restart [service]`
80
-
81
- Restarts the given service in the box.
82
-
83
- 7. `vagrant service-manager [command] [--help | -h]`
84
-
85
- Displays the possible commands, options and other relevant information for the vagrant-service-manager plugin. If a `command` is specified, only the help relevant to that command is displayed.
86
-
87
-
88
-
89
- ## Exit codes <a name="exit_codes"></a>
90
-
91
- The following table lists the plugin's exit codes and their meaning:
92
-
93
- Exit Code Number | Meaning
94
- -------------------|-------------------------------------------------------------------------
95
- `0` | No error
96
- `1` | Catch all for general errors / Wrong sub-command or option given
97
- `3` | Vagrant box is not running and should be running for this command to succeed
98
- `126` | A service inside the box is not running / Command invoked cannot execute
99
-
100
-
101
- ## IP Address Detection <a name="ip_addr"></a>
102
-
103
- There is no standardized way of detecting Vagrant box IP addresses.
104
- This code uses the last IPv4 address available from the set of configured addresses that are *up*. i.e. if eth0, eth1, and eth2 are all up and have IPv4 addresses, the address on eth2 is used.
105
-
106
-
107
- ## Getting Involved with the Project <a name="Contributing"></a>
108
-
109
- We welcome your input. You can submit issues or pull requests with respect to the vagrant-service-manager plugin. Refer to the [contributing guidelines](https://github.com/projectatomic/vagrant-service-manager/blob/master/CONTRIBUTING.md) for detailed information on how to contribute to this plugin.
110
-
111
- You can contact us on:
112
- * IRC: #atomic and #nulecule on freenode
113
- * Mailing List: container-tools@redhat.com
114
-
115
-
116
- ## Builds <a name="builds"></a>
117
-
118
- - Gem: https://rubygems.org/gems/vagrant-service-manager
119
-
120
- - Copr build: https://copr.fedorainfracloud.org/coprs/nshaikh/vagrant-service-manager/builds/