danarchy_sys 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/Gemfile +2 -0
  6. data/LICENSE +21 -0
  7. data/README.txt +86 -0
  8. data/Rakefile +6 -0
  9. data/bin/console +6 -0
  10. data/bin/danarchy_sys +4 -0
  11. data/bin/setup +18 -0
  12. data/bin/setup.rb +86 -0
  13. data/danarchy_sys.gemspec +38 -0
  14. data/lib/danarchy_sys.rb +16 -0
  15. data/lib/danarchy_sys/aws.rb +9 -0
  16. data/lib/danarchy_sys/aws/compute.rb +13 -0
  17. data/lib/danarchy_sys/cli.rb +63 -0
  18. data/lib/danarchy_sys/cli/instance_manager.rb +130 -0
  19. data/lib/danarchy_sys/cli/instance_manager/instance_status.rb +50 -0
  20. data/lib/danarchy_sys/cli/instance_manager/prompts_create_instance.rb +182 -0
  21. data/lib/danarchy_sys/cli/menus.rb +60 -0
  22. data/lib/danarchy_sys/cli/providers.rb +33 -0
  23. data/lib/danarchy_sys/config.rb +66 -0
  24. data/lib/danarchy_sys/helpers.rb +61 -0
  25. data/lib/danarchy_sys/openstack.rb +9 -0
  26. data/lib/danarchy_sys/openstack/compute.rb +59 -0
  27. data/lib/danarchy_sys/openstack/compute/flavors.rb +47 -0
  28. data/lib/danarchy_sys/openstack/compute/images.rb +52 -0
  29. data/lib/danarchy_sys/openstack/compute/instances.rb +120 -0
  30. data/lib/danarchy_sys/openstack/compute/keypairs.rb +84 -0
  31. data/lib/danarchy_sys/openstack/compute/tests/answer_yes.rb +7 -0
  32. data/lib/danarchy_sys/openstack/compute/tests/flavors_test.rb +10 -0
  33. data/lib/danarchy_sys/openstack/compute/tests/images_test.rb +14 -0
  34. data/lib/danarchy_sys/openstack/compute/tests/instance_create_test.rb +14 -0
  35. data/lib/danarchy_sys/openstack/compute/tests/instance_manage_test.rb +24 -0
  36. data/lib/danarchy_sys/openstack/compute/tests/keypairs_prompt_test.rb +12 -0
  37. data/lib/danarchy_sys/openstack/compute/tests/keypairs_test.rb +38 -0
  38. data/lib/danarchy_sys/openstack/compute/tests/manage_test.rb +16 -0
  39. data/lib/danarchy_sys/printformats.rb +49 -0
  40. data/lib/danarchy_sys/version.rb +3 -0
  41. metadata +151 -0
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fog/openstack'
3
+ require '../../../../danarchy_sys'
4
+ require '../../../helpers'
5
+ require '../instance_prompts'
6
+
7
+ os_connection_params = Connection.os_dreamcompute
8
+ compute = Fog::Compute::OpenStack.new(os_connection_params)
9
+ config = Config.os_dreamcompute
10
+
11
+ #@config = Config.os_dreamcompute
12
+ p ComputePrompts.keypair(config, compute)
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fog/openstack'
3
+ require_relative '../../../../danarchy_sys'
4
+
5
+ provider = 'os_dreamcompute'.to_sym
6
+ config = ConfigMgr.new
7
+ danarchysys_config = config.load
8
+
9
+ connection = danarchysys_config[:connections][provider]
10
+ settings = danarchysys_config[:settings]
11
+ compute = Fog::Compute::OpenStack.new(connection)
12
+
13
+ keypair_names = ["test", "test01", "test02", "test03", "test04"]
14
+ # keypair, pemfile = InstancePrompts.keypair(compute)
15
+ # puts "Keypair: #{keypair.name}"
16
+ # puts " .pem: #{pemfile}"
17
+ # keypair_name = keypair.name
18
+
19
+ # keypair_name = 'test02'
20
+ # pemfile = ComputeKeyPairs.pemfile_path(keypair_name)
21
+ # puts "Creating keypair: #{keypair_name}"
22
+ # keypair, pemfile = ComputeKeyPairs.create_keypair(compute, keypair_name, pemfile)
23
+ # keypair = ComputeKeyPairs.keypair_get(compute, keypair_name)
24
+ # puts "Keypair: #{keypair.name}"
25
+ # puts " .pem: #{pemfile}"
26
+
27
+ puts "\nListing keypairs...", ComputeKeyPairs.list_keypairs(compute)
28
+
29
+ # print "\npemfile_check: ", ComputeKeyPairs.pemfile_check(pemfile)
30
+ # print "\nkeypair_check: ", ComputeKeyPairs.keypair_check(compute, keypair_name)
31
+
32
+ keypair_names.each do |keypair_name|
33
+ puts "\nDeleting keypair: #{keypair_name}!"
34
+ ComputeKeyPairs.delete_keypair(settings, compute, keypair_name)
35
+ print "\nPost delete keypair_check: ", ComputeKeyPairs.check_keypair(compute, keypair_name), "\n"
36
+ end
37
+
38
+ # print "\nPost delete pemfile_check: ", ComputeKeyPairs.pemfile_check(pemfile)
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fog/openstack'
3
+ require '../../connection'
4
+ require '../instance_manage'
5
+
6
+ @os_connection_params = Connection.os_dreamcompute
7
+ @compute = Fog::Compute::OpenStack.new(@os_connection_params)
8
+
9
+ instances = InstanceManage.list_instances(@compute)
10
+ puts instances
11
+
12
+ print "Let's create a new instance.\nWhat should we name it? : "
13
+ instance_name = gets.chomp
14
+
15
+ puts "Creating instance..."
16
+ instance =
@@ -0,0 +1,49 @@
1
+
2
+ class PrintFormats
3
+ def self.printf_array(array)
4
+ fields = []
5
+
6
+ array.each do |v|
7
+ fields.push("%-#{v.size + 1}s")
8
+ end
9
+
10
+ fields.join(' ')
11
+ end
12
+
13
+ def self.printf_numhash(hash)
14
+ fields = []
15
+
16
+ fields.push("%-#{Helpers.hash_largest_key(hash).size + 1}s")
17
+ fields.push("%#{Helpers.hash_largest_nested_key(hash).size + 1}s")
18
+ fields.push("%-#{Helpers.hash_largest_nested_value(hash).size}s")
19
+
20
+ fields.join(' ')
21
+ end
22
+
23
+ def self.printf_hash(hash)
24
+ fields = []
25
+
26
+ fields.push("%#{Helpers.hash_largest_key(hash).size}s")
27
+ fields.push("%-#{Helpers.hash_largest_value(hash).size}s")
28
+
29
+ fields.join(' ')
30
+ end
31
+
32
+ def self.printf_numhash_values(hash, fields_arr)
33
+ (fields, a) = [], []
34
+
35
+ fields.push("%-#{Helpers.hash_largest_key(hash).size + 1}s")
36
+
37
+ fields_arr.each do |f|
38
+ hash.each_value do |v|
39
+ next if v[f] == nil
40
+ a.push(v[f].size)
41
+ end
42
+
43
+ fields.push("%-#{a.max}s")
44
+ a = []
45
+ end
46
+
47
+ fields.join(' ')
48
+ end
49
+ end
@@ -0,0 +1,3 @@
1
+ module DanarchySys
2
+ VERSION = "0.2.10"
3
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: danarchy_sys
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.10
5
+ platform: ruby
6
+ authors:
7
+ - Dan James
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-07-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fog-openstack
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.1.20
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.1.20
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.13'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.13'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '10.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '10.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rspec
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '3.0'
75
+ description: dAnarchy Sys is intended to be a platform for the management of cloud
76
+ compute instances from initial setup through to the deployment of end-user software.
77
+ email:
78
+ - danheneise@me.com
79
+ executables:
80
+ - console
81
+ - danarchy_sys
82
+ - setup
83
+ - setup.rb
84
+ extensions: []
85
+ extra_rdoc_files: []
86
+ files:
87
+ - ".gitignore"
88
+ - ".rspec"
89
+ - ".travis.yml"
90
+ - Gemfile
91
+ - LICENSE
92
+ - README.txt
93
+ - Rakefile
94
+ - bin/console
95
+ - bin/danarchy_sys
96
+ - bin/setup
97
+ - bin/setup.rb
98
+ - danarchy_sys.gemspec
99
+ - lib/danarchy_sys.rb
100
+ - lib/danarchy_sys/aws.rb
101
+ - lib/danarchy_sys/aws/compute.rb
102
+ - lib/danarchy_sys/cli.rb
103
+ - lib/danarchy_sys/cli/instance_manager.rb
104
+ - lib/danarchy_sys/cli/instance_manager/instance_status.rb
105
+ - lib/danarchy_sys/cli/instance_manager/prompts_create_instance.rb
106
+ - lib/danarchy_sys/cli/menus.rb
107
+ - lib/danarchy_sys/cli/providers.rb
108
+ - lib/danarchy_sys/config.rb
109
+ - lib/danarchy_sys/helpers.rb
110
+ - lib/danarchy_sys/openstack.rb
111
+ - lib/danarchy_sys/openstack/compute.rb
112
+ - lib/danarchy_sys/openstack/compute/flavors.rb
113
+ - lib/danarchy_sys/openstack/compute/images.rb
114
+ - lib/danarchy_sys/openstack/compute/instances.rb
115
+ - lib/danarchy_sys/openstack/compute/keypairs.rb
116
+ - lib/danarchy_sys/openstack/compute/tests/answer_yes.rb
117
+ - lib/danarchy_sys/openstack/compute/tests/flavors_test.rb
118
+ - lib/danarchy_sys/openstack/compute/tests/images_test.rb
119
+ - lib/danarchy_sys/openstack/compute/tests/instance_create_test.rb
120
+ - lib/danarchy_sys/openstack/compute/tests/instance_manage_test.rb
121
+ - lib/danarchy_sys/openstack/compute/tests/keypairs_prompt_test.rb
122
+ - lib/danarchy_sys/openstack/compute/tests/keypairs_test.rb
123
+ - lib/danarchy_sys/openstack/compute/tests/manage_test.rb
124
+ - lib/danarchy_sys/printformats.rb
125
+ - lib/danarchy_sys/version.rb
126
+ homepage: https://github.com/danarchy85/danarchy_sys
127
+ licenses:
128
+ - MIT
129
+ metadata:
130
+ allowed_push_host: https://rubygems.org
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ requirements: []
146
+ rubyforge_project:
147
+ rubygems_version: 2.5.2
148
+ signing_key:
149
+ specification_version: 4
150
+ summary: Facilitates the deployment and management of OpenStack.
151
+ test_files: []