kaname 0.2.0 → 0.3.0
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 +4 -4
- data/.travis.yml +3 -1
- data/README.md +2 -2
- data/kaname.gemspec +1 -0
- data/lib/kaname/adapter/real.rb +22 -0
- data/lib/kaname/cli.rb +15 -0
- data/lib/kaname/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f2e7d466e2a52ae7929cda90f03ba22dc991308
|
4
|
+
data.tar.gz: a7fe1625673a2f04308d924d379f0ac8d338bac6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c8e5443af92addd2ce06383db1eea2a71766cf974b574945cab021f4fdcf1d28dab7bf9bc1296b0291568614e2370265f2b5be7d3046c78dedbadef8de06702
|
7
|
+
data.tar.gz: 2e58e65fe38ffbb30d1e8ae47ec0be53dc9d18592491108a3f081bf6c8b3611effbb5875b1dff8a436df196eb3a548de4e45bee25ae748b4606a2815c4c8d65a
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -41,8 +41,8 @@ run following command.
|
|
41
41
|
|
42
42
|
```sh
|
43
43
|
$ kaname diff # You can see difference of definition
|
44
|
-
$ kaname apply #
|
45
|
-
$ kaname apply --dryrun
|
44
|
+
$ kaname apply # apply configuration into OpenStack
|
45
|
+
$ kaname apply --dryrun # You can see all of invoke commands(dryrun)
|
46
46
|
```
|
47
47
|
|
48
48
|
You can create user and user's role with tenant.
|
data/kaname.gemspec
CHANGED
data/lib/kaname/adapter/real.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
1
3
|
module Kaname
|
2
4
|
module Adapter
|
3
5
|
class Real
|
@@ -19,6 +21,26 @@ module Kaname
|
|
19
21
|
Fog::Identity[:openstack].create_user_role(tenant.id, user_hash["id"], role.id)
|
20
22
|
end
|
21
23
|
|
24
|
+
def update_user_password(credentials, old_password, new_password)
|
25
|
+
if old_password && new_password
|
26
|
+
# TODO: need to confirm port number of endpoint
|
27
|
+
endpoint = "http://#{URI(credentials[:openstack_management_url]).hostname}:5000/v2.0"
|
28
|
+
url = URI.parse("#{endpoint}/OS-KSCRUD/users/#{credentials[:openstack_current_user_id]}")
|
29
|
+
req = Net::HTTP::Patch.new(url.path)
|
30
|
+
req["Content-type"] = "application/json"
|
31
|
+
req["X-Auth-Token"] = credentials[:openstack_auth_token]
|
32
|
+
req.body = JSON.generate({'user' => {'password' => new_password, 'original_password' => old_password}})
|
33
|
+
res = Net::HTTP.start(url.host, url.port) {|http|
|
34
|
+
http.request(req)
|
35
|
+
}
|
36
|
+
if res.code == "200"
|
37
|
+
puts "Your password is updated. Please update your ~/.fog configuration too."
|
38
|
+
else
|
39
|
+
raise "password updating is failed"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
22
44
|
def delete_user(name)
|
23
45
|
user = find_user(name)
|
24
46
|
Fog::Identity[:openstack].delete_user(user["id"])
|
data/lib/kaname/cli.rb
CHANGED
@@ -6,6 +6,21 @@ require 'diffy'
|
|
6
6
|
|
7
7
|
module Kaname
|
8
8
|
class CLI < Thor
|
9
|
+
desc 'password', 'Commands about updating user password'
|
10
|
+
def password
|
11
|
+
credentials = Fog::Identity[:openstack].credentials
|
12
|
+
puts "current_user: #{credentials[:current_user]["username"]}"
|
13
|
+
|
14
|
+
print "type your current password: "
|
15
|
+
old_password = STDIN.noecho(&:gets).strip
|
16
|
+
puts
|
17
|
+
print "type your new password: "
|
18
|
+
new_password = STDIN.noecho(&:gets).strip
|
19
|
+
puts
|
20
|
+
|
21
|
+
Kaname::Adapter::Real.new.update_user_password(credentials, old_password, new_password)
|
22
|
+
end
|
23
|
+
|
9
24
|
option :dryrun, type: :boolean
|
10
25
|
desc 'apply', 'Commands about configuration apply'
|
11
26
|
def apply
|
data/lib/kaname/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaname
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SHIBATA Hiroshi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: webmock
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: Identity configuration tool for OpenStack. You can apply simple YAML
|
126
140
|
definition into Keystone.
|
127
141
|
email:
|