forj 1.0.13 → 1.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +71 -66
- data/bin/forj +24 -24
- data/forj.gemspec +2 -2
- data/lib/boot.rb +3 -3
- data/lib/forj-settings.rb +37 -22
- data/lib/process/forj_core/data.yaml +11 -7
- data/lib/process/forj_core/process/ca_root_cert.rb +1 -1
- data/lib/process/forj_core/process/declare.rb +1 -0
- data/lib/process/forj_core/process/forj_process.rb +1 -2
- data/lib/process/forj_core/process/proxy.rb +25 -0
- data/lib/process/forj_core_process.rb +1 -1
- data/lib/ssh.rb +9 -23
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 613daa28b3ba9524c23beed49420d1893e909c24
|
4
|
+
data.tar.gz: da633b67dda381136608a689d9c47c484d5618c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbddb2c23bf804063c3106a646d08985c685dfc0b30363825bcda8b645534b7f09fec7a08c528bc0879bd9f8f38950cf054bab790fb069d6c1424a37411881eb
|
7
|
+
data.tar.gz: 5e8fcd27a45a2ce4153e699c5b70522637749f0fdb41460ed6f2d86bd98f33120869ec8b336cff7936ae8e822bb5f8deed187f5eb9beddab775c2f4a534a9f80
|
data/README.md
CHANGED
@@ -5,6 +5,8 @@ Forj cli
|
|
5
5
|
Installation
|
6
6
|
------------
|
7
7
|
|
8
|
+
Forj cli supports Ruby 1.9.3 or higher.
|
9
|
+
|
8
10
|
###Fedora/CentOS/Redhat rpm like package system
|
9
11
|
|
10
12
|
**For ruby 2.0**
|
@@ -17,19 +19,7 @@ Installation
|
|
17
19
|
**For ruby 1.9**
|
18
20
|
|
19
21
|
$ apt-get -y update
|
20
|
-
$ sudo apt-get install ruby1.9.
|
21
|
-
$ sudo gem install forj
|
22
|
-
|
23
|
-
|
24
|
-
**For ruby 1.8**
|
25
|
-
|
26
|
-
$ sudo apt-get install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 rubygems -y
|
27
|
-
$ sudo apt-get install libreadline-ruby1.8 libruby1.8 libopenssl-ruby -y
|
28
|
-
$ sudo apt-get install libxslt-dev libxml2-dev -y
|
29
|
-
$ sudo gem install nokogiri
|
30
|
-
$ sudo apt-get install ruby-bundler -y
|
31
|
-
$ sudo gem install mime-types -v 1.25.1
|
32
|
-
$ sudo gem install hpcloud
|
22
|
+
$ sudo apt-get install ruby1.9.3 ruby1.9.3-dev rubygems1.9.3 build-essential libopenssl-ruby1.9.3 libssl-dev zlib1g-dev libxml2-dev libxslt-dev git -y
|
33
23
|
$ sudo gem install forj
|
34
24
|
|
35
25
|
**Installation from source**
|
@@ -93,12 +83,7 @@ Quick steps: How to create a forj?
|
|
93
83
|
|
94
84
|
Ex: `forj boot redstone myforge` - This command will start a Redstone forge named 'myforge' with the default FORJ account. Previous, we set it to be MyAccount.
|
95
85
|
|
96
|
-
NOTE: If you are creating a Forge in a corporate network, a proxy may be required
|
97
|
-
You can ask `forj` cli to send the proxy to use with -e
|
98
|
-
|
99
|
-
Ex: Thanks to a CorporateAccount setup with forj setup, the following will use it and set the webproxy metadata.
|
100
|
-
|
101
|
-
`forj boot redstone myforge -a CorporateAccount -e webproxy=$http_proxy`
|
86
|
+
NOTE: If you are creating a Forge in a corporate network, a proxy may be required. See section [Commmon issues]
|
102
87
|
|
103
88
|
###Forj options:
|
104
89
|
|
@@ -123,76 +108,96 @@ Commands:
|
|
123
108
|
|
124
109
|
#### Configuration
|
125
110
|
|
126
|
-
|
111
|
+
When you create a new forj (`forj boot`), forj cli will load data from several layers of configuration:
|
112
|
+
|
113
|
+
1. Cloud account setting (`forj setup [account]` or `forj get -a <account>` list identified by 'account' origin)
|
114
|
+
2. Local configuration (`forj get` list identified by 'local' origin)
|
115
|
+
3. Application defaults and cloud model. (`forj get` list identified by 'forj_core' or 'default')
|
116
|
+
|
117
|
+
You can get a complete list of current values:
|
127
118
|
|
128
|
-
|
119
|
+
$ forj get
|
120
|
+
or
|
129
121
|
|
130
|
-
$ forj
|
122
|
+
$ forj get -a <account>
|
131
123
|
|
132
124
|
If you need to change one of them:
|
133
125
|
|
134
|
-
$ forj set "
|
126
|
+
$ forj set "security_group=test"
|
127
|
+
or
|
135
128
|
|
136
|
-
|
137
|
-
forj set keypair_name=nova
|
129
|
+
$ forj set "security_group=mysec" -a <account>
|
138
130
|
|
139
|
-
|
131
|
+
#### Connect to servers
|
140
132
|
|
141
|
-
|
133
|
+
To ssh into a server
|
142
134
|
|
135
|
+
$ forj ssh <name> [node]
|
136
|
+
e.g.
|
143
137
|
|
144
|
-
|
138
|
+
$ forj ssh myforge review # review is one node from redstone blueprint
|
145
139
|
|
146
|
-
|
140
|
+
Commmon issues
|
141
|
+
==============
|
147
142
|
|
143
|
+
Certificate Authorities
|
144
|
+
-----------------------
|
148
145
|
|
149
|
-
|
146
|
+
If your company certify your server with a private certificate authorities service, you may need to do the following:
|
150
147
|
|
151
|
-
|
152
|
-
account_name: name # Default forj account used to connect to your cloud. This setting is automatically set to the first account created with forj setup <CloudProvider>
|
153
|
-
maestro_url: url # Maestro GIT repository for clone.
|
154
|
-
infra_repo: path # Path to the default Infra repository used to store your specific bootstrap/build environment. By default: ~/.forj/infra
|
155
|
-
image: imageName # Image used to create Maestro and all forge boxes. By default, it is 'Ubuntu Precise 12.04.4 LTS Server 64-bit 20140414 (Rescue Image)'
|
156
|
-
# If you have created the generic proto2b image, you can set it here.
|
157
|
-
flavor: flavorName # Maestro Flavor name. This flavor is for Maestro only. Your blueprint layout defines each node flavors on needs.
|
158
|
-
# By default: standard.medium
|
159
|
-
bp_flavor: flavorName # Blueprint nodes default flavor. Usually, blueprint node are smaller than Maestro.
|
160
|
-
# By default: standard.small
|
161
|
-
ports: [Port1,Port2,...] # list of additional ports to add in your cloud security group.
|
162
|
-
# This list is added to the default one in defaults.yaml
|
163
|
-
keypair_path: path # Define the file path to your OpenSSH private key. Useful to access your box with ssh command line.
|
164
|
-
# By default. ~/.ssh/forj-id_rsa
|
165
|
-
keypair_name: name # keypair name defined in your cloud to access your server. By default we named it 'forj'. If it doesn't exist, it will be created.
|
166
|
-
router: name # Router name used by your forge boxes will use to access internet.
|
167
|
-
security_group: name # Security group name to configure and attach to each forge boxes.
|
168
|
-
network: name # Network name to attach to each forge boxes. By default we use 'private'. If it doesn't exist, it will be created.
|
169
|
-
# Internal use.
|
170
|
-
build_config: name # forj cli use 'build.sh' to create Maestro. See build_config option on build.sh to get more information. By default 'box'
|
171
|
-
branch: name # forj cli use 'build.sh' to create Maestro. See gitbranch option on build.sh to get more information. By default 'master'
|
172
|
-
box_name: maestro # forj cli use 'build.sh' to create Maestro. See box_name option on build.sh to get more information. By default 'maestro'
|
148
|
+
Either your workstation and your cloud may needs to be configured with this CA certificate.
|
173
149
|
|
174
|
-
|
150
|
+
* From your workstation:
|
175
151
|
|
176
|
-
forj
|
177
|
-
|
152
|
+
You can instantly provide the CA certificate to forj cli, with SSL_CERT_FILE env variable<BR>
|
153
|
+
ex:
|
178
154
|
|
179
|
-
|
180
|
-
|
155
|
+
SSL_CERT_FILE=~/tmp/cacert.crt forj boot redstone [...]
|
156
|
+
|
157
|
+
OR<BR>
|
158
|
+
|
159
|
+
You can install this certificate in your workstation. This case depends on your OS.<BR>
|
160
|
+
typical case:
|
161
|
+
|
162
|
+
* debian like system:
|
163
|
+
- cp file to /usr/share/ca-certificates/
|
164
|
+
- Update /etc/ca-certificates.conf
|
165
|
+
- call update-ca-certificates
|
166
|
+
* rpm like system:
|
167
|
+
- cp file to /etc/pki/ca-trust/source/anchors/
|
168
|
+
- call update-ca-trust extract
|
169
|
+
|
170
|
+
* In your cloud:
|
171
|
+
|
172
|
+
If your cloud is NOT preconfigured (images) with your Company CA certificate,
|
173
|
+
you can call forj cli with --ca-root-cert at boot time, to configure your boxes with this missing certificate.
|
174
|
+
|
175
|
+
ex:
|
176
|
+
|
177
|
+
forj boot redstone myforge --ca-root-cert ~/tmp/cacert.crt
|
178
|
+
|
179
|
+
You can ask server in your cloud to install it in specific path and file name
|
180
|
+
|
181
|
+
forj boot redstone myforge --ca-root-cert '~/tmp/cacert-2015-1.crt#mycompany/cacrt.crt'
|
182
|
+
|
183
|
+
You can also pre-configure your forj account with this certificate.
|
184
|
+
|
185
|
+
forj set ca-root-cert=~/tmp/cacert-2015-1.crt -a myaccount
|
186
|
+
or
|
187
|
+
|
188
|
+
forj set 'ca-root-cert=~/tmp/cacert-2015-1.crt#mycompany/cacrt.crt' -a myaccount
|
181
189
|
|
182
|
-
|
190
|
+
HTTP/HTTPS proxy
|
191
|
+
----------------
|
183
192
|
|
184
|
-
|
185
|
-
|
186
|
-
* SSL_CERT_FILE: path_to_file
|
193
|
+
If your cloud is NOT preconfigured (images) with your Company proxy setting,
|
194
|
+
you can ask forj cli to configure your server with the Proxy setting needed.
|
187
195
|
|
188
|
-
Ex:
|
189
196
|
|
190
|
-
|
191
|
-
forj setup myAccount openstack
|
197
|
+
Ex: boot a redstone 'myforge' with a proxy setting.
|
192
198
|
|
193
|
-
|
199
|
+
$ forj boot redstone myforge -a CorporateAccount -e webproxy=$http_proxy
|
194
200
|
|
195
|
-
SSL_CERT_FILE=~/ca.crt forj setup myAccount openstack
|
196
201
|
|
197
202
|
Contributing to Forj
|
198
203
|
=====================
|
data/bin/forj
CHANGED
@@ -16,8 +16,8 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
18
|
require 'rubygems'
|
19
|
-
#
|
20
|
-
#
|
19
|
+
# require 'debugger' # Use to debug with Ruby < 2.0
|
20
|
+
# require 'byebug' # Use to debug with Ruby >= 2.0
|
21
21
|
require 'bundler/setup'
|
22
22
|
require 'thor'
|
23
23
|
require 'ansi'
|
@@ -166,24 +166,27 @@ If you want to check/updated them, use `forj get [-a account]`
|
|
166
166
|
method_option :tb_path, :aliases => '-t',
|
167
167
|
:desc => 'Define the path to the test-box script. '\
|
168
168
|
'This option superseeds the TEST_BOX '\
|
169
|
-
|
169
|
+
'environment variable.'
|
170
170
|
method_option :test_box, :aliases => '-T', :type => :array,
|
171
171
|
:desc => "Use a local repository for test-box\n\n"\
|
172
172
|
'Other options:'
|
173
173
|
method_option :extra_metadata, :aliases => '-e', :desc => 'Custom' \
|
174
174
|
' server metadata format key1=value1,key2=value2...,keyN=valueN'
|
175
175
|
|
176
|
+
method_option :webproxy, :aliases => '-x',
|
177
|
+
:desc => 'Set HTTP/HTTPS proxy setting from'\
|
178
|
+
' your cloud'
|
176
179
|
method_option :ca_root_cert, :desc => 'Certificate Authorities file used by'\
|
177
180
|
' your compagny to authenticate your intranet servers.'
|
178
181
|
|
179
182
|
def boot(blueprint, on_or_name, old_accountname = nil, as = nil,
|
180
183
|
old_name = nil)
|
181
|
-
Forj::Settings.common_options(options)
|
184
|
+
opts = Forj::Settings.common_options(options)
|
182
185
|
require 'boot.rb'
|
183
186
|
|
184
187
|
deprecated_name = [old_accountname, as, old_name]
|
185
188
|
|
186
|
-
Forj::Boot.boot(blueprint, on_or_name, deprecated_name,
|
189
|
+
Forj::Boot.boot(blueprint, on_or_name, deprecated_name, opts)
|
187
190
|
end
|
188
191
|
|
189
192
|
################################# Show defaults
|
@@ -201,7 +204,7 @@ queriable Objects:
|
|
201
204
|
desc 'show <Object> [name]', 'Show Object (default valuesr, account data,' \
|
202
205
|
' etc...) values.'
|
203
206
|
def show(object, name = nil)
|
204
|
-
Forj::Settings.common_options(options)
|
207
|
+
opts = Forj::Settings.common_options(options)
|
205
208
|
|
206
209
|
case object
|
207
210
|
when 'defaults'
|
@@ -240,7 +243,7 @@ queriable Objects:
|
|
240
243
|
puts o_config.config_dump([%(account)]).to_yaml
|
241
244
|
puts '---'
|
242
245
|
puts format("To change those values, execute 'forj setup -a %s'.",
|
243
|
-
|
246
|
+
opts[:account_name])
|
244
247
|
|
245
248
|
else
|
246
249
|
PrcLib.error("object '%s' unknown.", name)
|
@@ -265,8 +268,8 @@ Warning! This action do not remove any network/security groups cloud object.
|
|
265
268
|
' Account, config file or forj defaults.'
|
266
269
|
def destroy(name)
|
267
270
|
require 'destroy.rb'
|
268
|
-
Forj::Settings.common_options(options)
|
269
|
-
Forj::Destroy.destroy(name,
|
271
|
+
opts = Forj::Settings.common_options(options)
|
272
|
+
Forj::Destroy.destroy(name, opts)
|
270
273
|
end
|
271
274
|
|
272
275
|
################################# SET
|
@@ -310,13 +313,12 @@ you can set it as your default, with:
|
|
310
313
|
' local config file.'
|
311
314
|
|
312
315
|
def set(*p)
|
313
|
-
|
314
|
-
PrcLib.level = Logger::DEBUG if options[:debug]
|
316
|
+
opts = Forj::Settings.common_options(options)
|
315
317
|
|
316
318
|
if p.length == 0
|
317
|
-
Forj::Settings.show_settings(
|
319
|
+
Forj::Settings.show_settings(opts)
|
318
320
|
else
|
319
|
-
Forj::Settings.set_settings(
|
321
|
+
Forj::Settings.set_settings(opts, p)
|
320
322
|
end
|
321
323
|
end
|
322
324
|
|
@@ -349,11 +351,9 @@ or from your ~/.forj/config.yaml, or if not found, from application defaults.
|
|
349
351
|
' local config file.'
|
350
352
|
|
351
353
|
def get(key = nil)
|
352
|
-
|
353
|
-
PrcLib.level = Logger::DEBUG if options[:debug]
|
354
|
-
|
354
|
+
opts = Forj::Settings.common_options(options)
|
355
355
|
require 'get.rb'
|
356
|
-
Forj::Get.get(
|
356
|
+
Forj::Get.get(opts, key)
|
357
357
|
end
|
358
358
|
|
359
359
|
################################# SSH
|
@@ -373,13 +373,13 @@ ex: forj ssh myforge -n review
|
|
373
373
|
' local config file.'
|
374
374
|
|
375
375
|
def ssh(oInstanceName)
|
376
|
-
Forj::Settings.common_options(options)
|
376
|
+
opts = Forj::Settings.common_options(options)
|
377
377
|
require 'ssh.rb'
|
378
378
|
|
379
|
-
account = Lorj::Account.new(
|
379
|
+
account = Lorj::Account.new(opts[:config])
|
380
380
|
|
381
381
|
# Setting account at runtime layer
|
382
|
-
account[:account_name] =
|
382
|
+
account[:account_name] = opts[:account_name] if opts[:account_name]
|
383
383
|
|
384
384
|
# Setting account at account layer
|
385
385
|
unless account.ac_load account[:account_name]
|
@@ -388,8 +388,8 @@ ex: forj ssh myforge -n review
|
|
388
388
|
account[:account_name])
|
389
389
|
end
|
390
390
|
|
391
|
-
account.set(:box_ssh,
|
392
|
-
account.set(:identity,
|
391
|
+
account.set(:box_ssh, opts[:box_name]) if opts[:box_name]
|
392
|
+
account.set(:identity, opts[:identity]) if opts[:identity]
|
393
393
|
|
394
394
|
Forj::Ssh.connect(oInstanceName, account)
|
395
395
|
end
|
@@ -417,10 +417,10 @@ Several data will be requested like:
|
|
417
417
|
\x5- domain name to add to each boxes hostname
|
418
418
|
LONGDESC
|
419
419
|
def setup(sAccountName = 'hpcloud', sProvider = 'hpcloud')
|
420
|
-
Forj::Settings.common_options(options)
|
420
|
+
opts = Forj::Settings.common_options(options)
|
421
421
|
require 'cloud_connection.rb'
|
422
422
|
|
423
|
-
account = Lorj::Account.new(
|
423
|
+
account = Lorj::Account.new(opts[:config], Forj.file_version)
|
424
424
|
account.ac_new(sAccountName, sProvider) unless account.ac_load(sAccountName)
|
425
425
|
|
426
426
|
o_cloud = Forj::CloudConnection.connect(account)
|
data/forj.gemspec
CHANGED
@@ -19,8 +19,8 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.name = 'forj'
|
20
20
|
s.homepage = 'https://www.forj.io'
|
21
21
|
|
22
|
-
s.version = '1.0.
|
23
|
-
s.date = '2015-05
|
22
|
+
s.version = '1.0.14'
|
23
|
+
s.date = '2015-06-05'
|
24
24
|
s.summary = 'forj command line'
|
25
25
|
s.description = 'forj cli - See https://www.forj.io for documentation/information'
|
26
26
|
|
data/lib/boot.rb
CHANGED
@@ -38,7 +38,7 @@ module Forj
|
|
38
38
|
blueprint, old_accountname, old_name, blueprint, old_name
|
39
39
|
)
|
40
40
|
|
41
|
-
if account.get(
|
41
|
+
if account.get(:account_name) == old_accountname
|
42
42
|
PrcLib.warning('%s` instead.', msg)
|
43
43
|
else
|
44
44
|
PrcLib.warning("%s -a '%s'` instead.", msg, old_accountname)
|
@@ -127,7 +127,6 @@ module Forj
|
|
127
127
|
@account[:account_name], @account[:account_name])
|
128
128
|
end
|
129
129
|
|
130
|
-
options = options.to_h
|
131
130
|
options['tb_path'] = nil if options.key?('test_box') &&
|
132
131
|
!options.key?('tb_path')
|
133
132
|
options_map = { :infra => :infra_repo,
|
@@ -142,7 +141,8 @@ module Forj
|
|
142
141
|
:test_box => :test_box,
|
143
142
|
:tb_path => :test_box_path,
|
144
143
|
:ca_root_cert => :ca_root_cert,
|
145
|
-
:extra_metadata => :extra_metadata
|
144
|
+
:extra_metadata => :extra_metadata,
|
145
|
+
:webproxy => :webproxy }
|
146
146
|
|
147
147
|
load_options(options, options_map) { |k, v| complete_boot_options(k, v) }
|
148
148
|
|
data/lib/forj-settings.rb
CHANGED
@@ -20,13 +20,20 @@ module Forj
|
|
20
20
|
# This module helps you to setup your forge's account
|
21
21
|
module Settings
|
22
22
|
def self.common_options(options)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
PrcLib.
|
23
|
+
opts = options.to_hash
|
24
|
+
if opts.rh_key_to_symbol?
|
25
|
+
opts = opts.rh_key_to_symbol
|
26
|
+
PrcLib.debug('Thor options converted to use Symbol instead of String '\
|
27
|
+
'in keys')
|
28
|
+
end
|
29
|
+
PrcLib.level = Logger::INFO if opts[:verbose]
|
30
|
+
PrcLib.level = Logger::DEBUG if opts[:debug]
|
31
|
+
unless opts[:lorj_debug].nil?
|
32
|
+
PrcLib.core_level = opts[:lorj_debug].to_i
|
27
33
|
PrcLib.level = Logger::DEBUG
|
28
34
|
end
|
29
|
-
latest_version?(
|
35
|
+
latest_version?(opts[:account_name]) if opts[:account_name]
|
36
|
+
opts
|
30
37
|
end
|
31
38
|
|
32
39
|
def self.latest_version?(account_name)
|
@@ -74,14 +81,19 @@ module Forj
|
|
74
81
|
|
75
82
|
def self.config_show_all
|
76
83
|
config = Lorj::Account.new
|
84
|
+
|
85
|
+
a_processes = [{ :process_module => :cloud },
|
86
|
+
{ :process_module => :forj_core }]
|
87
|
+
|
88
|
+
# Loading CloudCore embedding provider controller + its process.
|
89
|
+
Lorj::Core.new(config, a_processes)
|
90
|
+
|
77
91
|
puts 'List of available FORJ default settings:'
|
78
|
-
puts format(
|
79
|
-
|
80
|
-
|
81
|
-
'section name'
|
82
|
-
)
|
92
|
+
puts format("%-15s %-12s :\n------------------------------",
|
93
|
+
'key', 'section name')
|
94
|
+
|
83
95
|
config.meta_each do |section, found_key, hValue|
|
84
|
-
next if hValue.rh_get(:readonly) || hValue.rh_get(:get) ==
|
96
|
+
next if hValue.rh_get(:readonly) || hValue.rh_get(:get) == false
|
85
97
|
s_desc = hValue.rh_get(:desc)
|
86
98
|
puts format('%-15s %-12s : %s', found_key, section, s_desc)
|
87
99
|
end
|
@@ -255,12 +267,20 @@ module Forj
|
|
255
267
|
false
|
256
268
|
end
|
257
269
|
|
270
|
+
# Function to highlight the data origin
|
271
|
+
# => yellow : account
|
272
|
+
# => white : local config
|
273
|
+
# => normal : all other config
|
274
|
+
#
|
275
|
+
#
|
258
276
|
def self.format_highlight(account_name, config_where, where_format)
|
259
|
-
|
277
|
+
res = format(where_format, 'default')
|
278
|
+
return res unless config_where == 'local' || config_where == 'account'
|
279
|
+
|
280
|
+
res = ANSI.bold(format(where_format, config_where))
|
281
|
+
return res if config_where == 'local'
|
260
282
|
|
261
|
-
|
262
|
-
account_name)) if config_where == 'account'
|
263
|
-
ANSI.bold(ANSI.yellow(format(where_format, config_where)))
|
283
|
+
ANSI.yellow(ANSI.bold(format(where_format, account_name)))
|
264
284
|
end
|
265
285
|
|
266
286
|
def self.get_account_values(account, account_name)
|
@@ -285,18 +305,13 @@ module Forj
|
|
285
305
|
s_upd_msg, mykey, where_highlight, section,
|
286
306
|
account.get(mykey, nil, :section => section), default_key)
|
287
307
|
else
|
288
|
-
puts format(
|
289
|
-
|
290
|
-
s_upd_msg,
|
291
|
-
mykey,
|
292
|
-
section
|
293
|
-
)
|
308
|
+
puts format('%s %-15s( ) %-12s: unset',
|
309
|
+
s_upd_msg, mykey, section)
|
294
310
|
end
|
295
311
|
end
|
296
312
|
end
|
297
313
|
|
298
314
|
def self.account_get_all(oConfig, account_name)
|
299
|
-
# byebug
|
300
315
|
PrcLib.fatal(1, "Unable to load account '%s'. Not found.",
|
301
316
|
account_name) unless oConfig.ac_load account_name
|
302
317
|
Forj::CloudConnection.connect(oConfig)
|
@@ -151,7 +151,7 @@
|
|
151
151
|
:required: true
|
152
152
|
:ask_sort: 0
|
153
153
|
:default_value: "<%= (config[:provider] == 'openstack')?config['credentials#auth_uri']:nil %>"
|
154
|
-
:validate: !ruby/regexp
|
154
|
+
:validate: !ruby/regexp /^http.*v2.0\/tokens$/
|
155
155
|
:ask_step: :gardener_config
|
156
156
|
|
157
157
|
|
@@ -176,6 +176,10 @@
|
|
176
176
|
:pre_step_function: :forj_dns_settings?
|
177
177
|
:ask_step: :dns_config
|
178
178
|
|
179
|
+
:network:
|
180
|
+
:webproxy:
|
181
|
+
:desc: "HTTP/HTTPS proxy setting to access internet from your cloud"
|
182
|
+
|
179
183
|
# Defines maestro environment.
|
180
184
|
:maestro:
|
181
185
|
:tenant_name:
|
@@ -280,16 +284,16 @@
|
|
280
284
|
# As forj_core is based on lorj_cloud, we have to disable Lorj_cloud data defaults.
|
281
285
|
:server:
|
282
286
|
:network_name:
|
283
|
-
:
|
287
|
+
:get: false
|
284
288
|
:security_group:
|
285
|
-
:
|
289
|
+
:get: false
|
286
290
|
:box_name:
|
287
|
-
:
|
291
|
+
:get: false
|
288
292
|
:flavor_name:
|
289
|
-
:
|
293
|
+
:get: false
|
290
294
|
:account: false
|
291
295
|
:image_name:
|
292
296
|
:account: false
|
293
|
-
:
|
297
|
+
:get: false
|
294
298
|
:ports:
|
295
|
-
:
|
299
|
+
:get: false
|
@@ -65,6 +65,7 @@ class Lorj::BaseDefinition # rubocop: disable Style/ClassAndModuleChildren
|
|
65
65
|
obj_needs :data, 'credentials#auth_uri'
|
66
66
|
obj_needs_optional
|
67
67
|
|
68
|
+
obj_needs :data, 'network#webproxy'
|
68
69
|
# If requested by user, ask Maestro to manage the DNS.
|
69
70
|
obj_needs :data, 'dns#dns_service'
|
70
71
|
obj_needs :data, 'dns#dns_tenant_id'
|
@@ -625,6 +625,7 @@ DNS_SECRET='#{hParams['credentials#account_key']}'
|
|
625
625
|
|
626
626
|
tb_metadata(hParams, h_meta)
|
627
627
|
ca_root_metadata(hParams, h_meta)
|
628
|
+
proxy_metadata(hParams, h_meta)
|
628
629
|
|
629
630
|
h_meta
|
630
631
|
end
|
@@ -1473,8 +1474,6 @@ class ForjCoreProcess
|
|
1473
1474
|
begin
|
1474
1475
|
PrcLib.state("creating ssh connection with '%s' box", o_server[:name])
|
1475
1476
|
ssh_login(ssh_options, user, public_ip)
|
1476
|
-
PrcLib.debug('Error closing ssh connection, box %s ',
|
1477
|
-
o_server[:name]) unless session
|
1478
1477
|
rescue => e
|
1479
1478
|
PrcLib.fatal 1, <<-END
|
1480
1479
|
#{e.message}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Functions for test-box
|
18
|
+
class ForjCoreProcess
|
19
|
+
# This function configure the proxy metadata
|
20
|
+
def proxy_metadata(hParams, metadata)
|
21
|
+
return unless hParams.exist?('network#webproxy')
|
22
|
+
|
23
|
+
metadata['webproxy'] = hParams['network#webproxy']
|
24
|
+
end
|
25
|
+
end
|
@@ -19,7 +19,7 @@ FORJCORE_PATH = File.expand_path(File.dirname(__FILE__))
|
|
19
19
|
|
20
20
|
# Define model
|
21
21
|
|
22
|
-
lorj_objects = %w(forj_process test_box ca_root_cert declare)
|
22
|
+
lorj_objects = %w(forj_process test_box ca_root_cert proxy declare)
|
23
23
|
|
24
24
|
lorj_objects.each do |name|
|
25
25
|
load File.join(FORJCORE_PATH, 'forj_core', 'process', name + '.rb')
|
data/lib/ssh.rb
CHANGED
@@ -38,21 +38,13 @@ module Forj
|
|
38
38
|
|
39
39
|
if o_forge[:servers].count > 0
|
40
40
|
if account[:box_ssh]
|
41
|
-
|
41
|
+
server = validate_server_name(name, account[:box_ssh], o_forge)
|
42
42
|
|
43
|
-
if
|
44
|
-
ssh_connection(account, o_cloud, name, o_server)
|
45
|
-
else
|
46
|
-
PrcLib.debug("server '%s.%s' was not found",
|
47
|
-
account[:box_ssh], name)
|
48
|
-
PrcLib.high_level_msg("server '%s.%s' was not found.\n",
|
49
|
-
account[:box_ssh], name)
|
50
|
-
end
|
43
|
+
return if server.nil?
|
51
44
|
else
|
52
45
|
server = select_forge_server(o_forge)
|
53
|
-
|
54
|
-
ssh_connection(account, o_cloud, name, server)
|
55
46
|
end
|
47
|
+
ssh_connection(account, o_cloud, name, server)
|
56
48
|
else
|
57
49
|
PrcLib.high_level_msg("No server(s) found for instance name '%s' \n",
|
58
50
|
name)
|
@@ -85,20 +77,14 @@ module Forj
|
|
85
77
|
o_cloud.create(:ssh, :server => server)
|
86
78
|
end
|
87
79
|
|
88
|
-
def self.validate_server_name(name,
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
o_forge[:servers].each do |server|
|
95
|
-
o_name = server[:name]
|
96
|
-
next if (regex =~ o_name).nil?
|
97
|
-
o_server = server
|
98
|
-
break
|
80
|
+
def self.validate_server_name(name, box_ssh, o_forge)
|
81
|
+
unless o_forge[:servers].key?(box_ssh)
|
82
|
+
PrcLib.debug("server '%s.%s' was not found", box_ssh, name)
|
83
|
+
PrcLib.high_level_msg("server '%s.%s' was not found.\n", box_ssh, name)
|
84
|
+
return
|
99
85
|
end
|
100
86
|
|
101
|
-
|
87
|
+
o_forge[:servers][box_ssh]
|
102
88
|
end
|
103
89
|
end
|
104
90
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- forj team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05
|
11
|
+
date: 2015-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -211,6 +211,7 @@ files:
|
|
211
211
|
- lib/process/forj_core/process/ca_root_cert.rb
|
212
212
|
- lib/process/forj_core/process/declare.rb
|
213
213
|
- lib/process/forj_core/process/forj_process.rb
|
214
|
+
- lib/process/forj_core/process/proxy.rb
|
214
215
|
- lib/process/forj_core/process/test_box.rb
|
215
216
|
- lib/process/forj_core_process.rb
|
216
217
|
- lib/ssh.rb
|