vboxmanage 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68096ed344f15f018d05ee515719bbec8967f57e
4
- data.tar.gz: 4f1cbe15726039fac8c0d37f39bf6f770d0a7a2f
3
+ metadata.gz: 358a93c23fd1c2adbe69870a41fe67321319117d
4
+ data.tar.gz: e14cc4c084b229b2b4169976321ceb021e98fd41
5
5
  SHA512:
6
- metadata.gz: 37db7580857b4ad980fc52286cce4ff341dfe7c6520e2fd3c5175d08d09b2f1c7ae221197f4b09a40ebfcf5c690907b249c8ec555a5deaebd5cf306c848a7482
7
- data.tar.gz: 0dcec80c787efdb21d53db53e88ff00014e7935a98004fb6790289c956c771caacf48fc0bcc1008f7ee045444509ab9a5c7989aa7f30826d9e45639457f47f3b
6
+ metadata.gz: 809b5436b14a79c6631e3808be9a7602ba2db26ece56d0a8da4a13b3462104a8514ef3e7f68f2ec09edb22672a35c7767ea7bf32292bcd63cfe14b87e90329b1
7
+ data.tar.gz: 093196cc60b463ac5c6ae08ae7842c98c623a7d6698a7d44a59ca4d5bb5adc67d0e2c77e570698ac758f4cec4e53ddde867fd13170b67bf47e578e89843b96ea
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vboxmanage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Reilly
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-27 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,17 +44,7 @@ email:
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
- files:
48
- - ".gitignore"
49
- - CODE_OF_CONDUCT.md
50
- - Gemfile
51
- - README.md
52
- - Rakefile
53
- - bin/console
54
- - bin/setup
55
- - lib/vboxmanage.rb
56
- - lib/vboxmanage/version.rb
57
- - vboxmanage.gemspec
47
+ files: []
58
48
  homepage: https://github.com/rj-reilly/vboxmanage
59
49
  licenses: []
60
50
  metadata: {}
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at robertjreilly@gmail.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in vboxmanage.gemspec
6
- gemspec
data/README.md DELETED
@@ -1,39 +0,0 @@
1
- # Vboxmanage
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/vboxmanage`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'vboxmanage'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install vboxmanage
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/vboxmanage. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
-
37
- ## Code of Conduct
38
-
39
- Everyone interacting in the Vboxmanage project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/vboxmanage/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require "bundler/gem_tasks"
2
- task :default => :spec
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "vboxmanage"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,105 +0,0 @@
1
- require "vboxmanage/version"
2
- require "net/ssh"
3
-
4
- module Vboxmanage
5
- VBOX='/usr/bin/vboxmanage'
6
- VBOXH='/usr/bin/VBoxHeadless'
7
- log=""
8
-
9
-
10
- def vmList
11
- machine = Hash.new
12
- %x("#{VBOX}" list vms|sed 's/{//g'|sed 's/}//g'|sed 's/"//g').each_line do |l|
13
- (name,id) = l.split(/\s+/,2)
14
- machine[name] = id.chomp
15
- end
16
- return machine
17
- end
18
-
19
- def vmExists?(name)
20
- machines = vmList()
21
- if machines.has_key?(name)
22
- return machines[name]
23
- end
24
- end
25
-
26
- def vmStart(name)
27
- p1 = fork { exec("#{VBOXH} --startvm #{name}") }
28
- Process.detach(p1)
29
- id = vmExists?(name)
30
- puts "Started #{name}"
31
- end
32
-
33
- def vmState(name)
34
- state = Hash.new
35
- %x("#{VBOX}" showvminfo "#{name}" --details --machinereadable).each_line do |l|
36
- (key,value) = l.split(/\=/,2)
37
- nv = value.gsub(/"/, '')
38
- state[key] = nv.chomp
39
- end
40
- return state
41
- end
42
-
43
- def vmRunning?(name)
44
- state = vmState(name)
45
- if state['VMState'].eql?("running")
46
- puts true
47
- else
48
- puts false
49
- end
50
- end
51
-
52
- def vmCreate(name,dest,image, cpu, memory)
53
- log=""
54
- if vmExists?(name)
55
- puts "#{name} vm already exists aborting"
56
- exit 1
57
- end
58
- #VBoxManage clonemedium disk /vms/image_build/centos7/output-virtualbox-iso/centos7-base-0.1.0-disk001.vmdk /vms/${VM}/${VM}.vdi --format VDI
59
- puts "Cloning Device"
60
- log << %x("#{VBOX}" clonemedium disk "#{image}" "#{dest}/#{name}/#{name}.vdi" --format VDI)
61
- puts "Creating VM"
62
- log << %x("#{VBOX}" createvm --name "#{name}" --register)
63
- puts "Set Mem"
64
- log << %x("#{VBOX}" modifyvm "#{name}" --memory "#{memory}")
65
- puts "Set CPU"
66
- log << %x("#{VBOX}" modifyvm "#{name}" --cpus "#{cpu}")
67
- log << %x("#{VBOX}" modifyvm "#{name}" --ioapic on)
68
- log << %x("#{VBOX}" modifyvm "#{name}" --nic1 bridged --bridgeadapter1 eno1 --nictype1 virtio --cableconnected1 on)
69
- log << %x("#{VBOX}" modifyvm "#{name}" --macaddress1 auto)
70
- log << %x("#{VBOX}" modifyvm "#{name}" --ostype RedHat_64)
71
- # log << %x("#{VBOX}" modifyvm "#{name}" --audio alsa)
72
- log << %x("#{VBOX}" storagectl "#{name}" --name "SATA Controller" --add sata)
73
- log << %x("#{VBOX}" modifyvm "#{name}" --macaddress1 auto)
74
- log << %x("#{VBOX}" storageattach "#{name}" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "#{dest}/#{name}/#{name}.vdi")
75
- log << %x("#{VBOX}" createhd --filename "#{dest}/#{name}/#{name}-app.vdi" --size 20)
76
- log << %x("#{VBOX}" storageattach "#{name}" --storagectl "SATA Controller" --port 1 --device 0 --type hdd --medium "#{dest}/#{name}/#{name}-app.vdi")
77
- vmStart(name)
78
- until vmAvail('root', name)
79
- do
80
- printf "."
81
- end
82
- end
83
-
84
-
85
- def vmAvail(user, name)
86
- puts "SSHing #{host} ..."
87
- Net::SSH.start( host.to_s, user.to_s, :password => pass.to_s ) do |ssh|
88
- puts ssh.exec!('date')
89
- puts "Logging out..."
90
- end
91
- end
92
-
93
- def vmStop(name)
94
- uuid = vmExists?(name)
95
- %x("#{VBOX}" controlvm "#{uuid}" poweroff)
96
- end
97
-
98
-
99
- def vmDestroy(name)
100
- vmStop(name)
101
- uuid = vmExists?(name)
102
- %x("#{VBOX}" unregistervm "#{uuid}" --delete)
103
- end
104
-
105
- end
@@ -1,3 +0,0 @@
1
- module Vboxmanage
2
- VERSION = "0.1.0"
3
- end
@@ -1,34 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "vboxmanage/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "vboxmanage"
8
- spec.version = Vboxmanage::VERSION
9
- spec.authors = ["Robert Reilly"]
10
- spec.email = ["robertjreilly@gmail.com"]
11
-
12
- spec.summary = %q{Mange Virtualbox from Ruby}
13
- spec.description = %q{Mange Virtualbox from Ruby}
14
- spec.homepage = "https://github.com/rj-reilly/vboxmanage"
15
-
16
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
- # to allow pushing to a single host or delete this section to allow pushing to any host.
18
- # if spec.respond_to?(:metadata)
19
- # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
20
- # else
21
- # raise "RubyGems 2.0 or newer is required to protect against " \
22
- # "public gem pushes."
23
- # end
24
-
25
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
- f.match(%r{^(test|spec|features)/})
27
- end
28
- spec.bindir = "exe"
29
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
- spec.require_paths = ["lib"]
31
-
32
- spec.add_development_dependency "bundler", "~> 1.15"
33
- spec.add_development_dependency "rake", "~> 10.0"
34
- end