pec 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/pec.rb +7 -6
- data/lib/pec/cli.rb +16 -11
- data/lib/pec/command.rb +1 -0
- data/lib/pec/command/config.rb +4 -2
- data/lib/pec/command/list.rb +13 -0
- data/lib/pec/command/status.rb +3 -2
- data/lib/pec/version.rb +1 -1
- 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: 5e8eba0965d155a9f519d921295e942b6b106775
|
4
|
+
data.tar.gz: fa6a457c9dd23058705d20369890c3b772a251ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f3e85aa04e43cc5f40f8dda96e5b7aa00455741ab24ebcd19a5c04c9861b952e6162cdd2ed37e49f29077cf2d24209a477d1408d270abcfe51c8b3722eff3ff
|
7
|
+
data.tar.gz: 0ba33459b7b1528d83f9cb10320240cc62eb8e91b940965d134596ec0a7f8bf6a14d53a69b4d193ce07c4a0347bce83be21894ae4aeea8861f692c2ba3a48046
|
data/README.md
CHANGED
@@ -18,13 +18,13 @@ create - /Pec.yaml
|
|
18
18
|
create - /user_data/web_server.yaml.sample
|
19
19
|
```
|
20
20
|
|
21
|
-
$ pec up <
|
21
|
+
$ pec up <hostname_regex> <hostname_regex>...
|
22
22
|
|
23
|
-
$ pec destroy <
|
23
|
+
$ pec destroy <hostname_regex> <hostname_regex>...
|
24
24
|
|
25
|
-
$ pec status <
|
25
|
+
$ pec status <hostname_regex> <hostname_regex>...
|
26
26
|
|
27
|
-
$ pec config
|
27
|
+
$ pec config <hostname_regex> <hostname_regex>...
|
28
28
|
|
29
29
|
### Configure
|
30
30
|
#### Pec.yaml
|
data/lib/pec.rb
CHANGED
@@ -39,15 +39,16 @@ module Pec
|
|
39
39
|
@_configure
|
40
40
|
end
|
41
41
|
|
42
|
-
def self.servers(
|
43
|
-
self.configure.each do |
|
44
|
-
next if
|
45
|
-
Pec.init_yao(
|
46
|
-
server = Yao::Server.list_detail.find {|s|s.name ==
|
47
|
-
yield(server,
|
42
|
+
def self.servers(hosts)
|
43
|
+
self.configure.each do |config|
|
44
|
+
next if hosts && hosts.none? {|name| config.name.match(/^#{name}/)}
|
45
|
+
Pec.init_yao(config.tenant)
|
46
|
+
server = Yao::Server.list_detail.find {|s|s.name == config.name}
|
47
|
+
yield(server, config)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
|
51
52
|
def self.check_env
|
52
53
|
%w(
|
53
54
|
OS_AUTH_URL
|
data/lib/pec/cli.rb
CHANGED
@@ -4,28 +4,33 @@ module Pec
|
|
4
4
|
|
5
5
|
desc 'init', 'create sample config'
|
6
6
|
def init
|
7
|
-
_sub_command(
|
7
|
+
_sub_command(nil, options)
|
8
8
|
end
|
9
9
|
|
10
10
|
desc 'up', 'create vm by Pec.yaml'
|
11
|
-
def up(
|
12
|
-
_sub_command(
|
11
|
+
def up(*hosts)
|
12
|
+
_sub_command(hosts, options)
|
13
13
|
end
|
14
14
|
|
15
15
|
option :force , type: :boolean, aliases: "-f"
|
16
16
|
desc "destroy", "delete vm"
|
17
|
-
def destroy(
|
18
|
-
_sub_command(
|
17
|
+
def destroy(*hosts)
|
18
|
+
_sub_command(hosts, options)
|
19
19
|
end
|
20
20
|
|
21
21
|
desc "status", "vm status"
|
22
|
-
def status(
|
23
|
-
_sub_command(
|
22
|
+
def status(*hosts)
|
23
|
+
_sub_command(hosts, options)
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "list", "vm list"
|
27
|
+
def list
|
28
|
+
_sub_command(nil, options)
|
24
29
|
end
|
25
30
|
|
26
31
|
desc "config", "show configure"
|
27
|
-
def config
|
28
|
-
_sub_command(
|
32
|
+
def config(*hosts)
|
33
|
+
_sub_command(hosts, options)
|
29
34
|
end
|
30
35
|
|
31
36
|
map %w[--version -v] => :__print_version
|
@@ -35,8 +40,8 @@ module Pec
|
|
35
40
|
end
|
36
41
|
|
37
42
|
no_commands do
|
38
|
-
def _sub_command(
|
39
|
-
Object.const_get("Pec::Command::#{caller[0][/`([^']*)'/, 1].capitalize}").run(
|
43
|
+
def _sub_command(hosts, options)
|
44
|
+
Object.const_get("Pec::Command::#{caller[0][/`([^']*)'/, 1].capitalize}").run(hosts, options)
|
40
45
|
end
|
41
46
|
end
|
42
47
|
end
|
data/lib/pec/command.rb
CHANGED
data/lib/pec/command/config.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
module Pec::Command
|
2
2
|
class Config < Base
|
3
|
-
def self.run(
|
3
|
+
def self.run(hosts, options)
|
4
4
|
puts YAML.dump(
|
5
|
-
YAML.load_file("Pec.yaml").to_hash.reject {|c|
|
5
|
+
YAML.load_file("Pec.yaml").to_hash.reject {|c|
|
6
|
+
c[0].to_s.match(/^_/) || (hosts && hosts.none? {|name| c.match(/^#{name}/)})
|
7
|
+
}
|
6
8
|
)
|
7
9
|
rescue => e
|
8
10
|
print_exception(e)
|
data/lib/pec/command/status.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
module Pec::Command
|
2
2
|
class Status < Base
|
3
3
|
def self.task(host_name, options, server, config)
|
4
|
-
Thor.new.say("Current machine
|
4
|
+
Thor.new.say("Current machine status:", :yellow)
|
5
5
|
if server
|
6
6
|
puts sprintf(
|
7
|
-
" %-35s %-10s %-10s %-10s %-10s %-35s %-48s",
|
7
|
+
" %-35s %-10s %-10s %-10s %-10s %-10s %-35s %-48s",
|
8
8
|
config.name,
|
9
9
|
server.status,
|
10
10
|
tenant_name(server),
|
11
11
|
flavor_name(server),
|
12
12
|
server.availability_zone,
|
13
|
+
server.key_name,
|
13
14
|
server.ext_srv_attr_host,
|
14
15
|
ip_addresses(server)
|
15
16
|
)
|
data/lib/pec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kazuhiko yamashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -147,6 +147,7 @@ files:
|
|
147
147
|
- lib/pec/command/config.rb
|
148
148
|
- lib/pec/command/destroy.rb
|
149
149
|
- lib/pec/command/init.rb
|
150
|
+
- lib/pec/command/list.rb
|
150
151
|
- lib/pec/command/status.rb
|
151
152
|
- lib/pec/command/up.rb
|
152
153
|
- lib/pec/config_error.rb
|