rs_user_policy 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
data/bin/rs_user_policy
CHANGED
@@ -36,6 +36,8 @@ class UserResourceDetailMock
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
+
exit_code = 0
|
40
|
+
|
39
41
|
opts = Trollop::options do
|
40
42
|
banner = "Manages users across many different child accounts of a RightScale Enterprise Master Account"
|
41
43
|
|
@@ -77,13 +79,19 @@ user_collection = RsUserPolicy::UserCollection.new
|
|
77
79
|
|
78
80
|
multi_client = RsUserPolicy::RightApi::MultiClient.new(opts[:rs_email], opts[:rs_pass], opts[:rs_acct_num])
|
79
81
|
|
82
|
+
log.info("Invoked with account numbers (#{opts[:rs_acct_num].join(",")}).")
|
83
|
+
|
80
84
|
# Iterate over all accounts once to discover users and their permissions
|
81
85
|
multi_client.each do |account_id, account|
|
82
86
|
child_client = account[:client]
|
83
87
|
child_account = child_client.accounts(:id => account_id).show()
|
84
88
|
account_href = child_account.href
|
85
|
-
|
86
|
-
|
89
|
+
users = child_client.users.index
|
90
|
+
permissions = child_client.permissions.index
|
91
|
+
user_collection.add_users(users)
|
92
|
+
user_collection.add_permissions(account_href, permissions)
|
93
|
+
|
94
|
+
log.info("#{child_account.name}:#{account_id} - #{child_account.href}; #{users.count} Users; #{permissions.count} Permissions")
|
87
95
|
end
|
88
96
|
|
89
97
|
# Populate the user_assignments with extra bits..
|
@@ -142,7 +150,6 @@ begin
|
|
142
150
|
account_name = child_account.name
|
143
151
|
account_href = child_account.href
|
144
152
|
|
145
|
-
log.info("#{account_name} - #{account_href}")
|
146
153
|
user_collection.users.each do |user|
|
147
154
|
email = user.email
|
148
155
|
user_role = user_assignments.get_roles(email)
|
@@ -168,6 +175,7 @@ begin
|
|
168
175
|
end
|
169
176
|
rescue RightApi::ApiError => e
|
170
177
|
log.fatal("A RightScale API exception occurred - #{e}")
|
178
|
+
exit_code = -1
|
171
179
|
end
|
172
180
|
|
173
181
|
user_collection.users.each do |user|
|
@@ -178,3 +186,5 @@ end unless opts[:dry_run]
|
|
178
186
|
|
179
187
|
user_assignments.serialize(:filename => user_assignments_output)
|
180
188
|
audit_log.write_file
|
189
|
+
|
190
|
+
exit exit_code
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rs_user_policy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: right_api_client
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.5.
|
21
|
+
version: 1.5.12
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 1.5.
|
29
|
+
version: 1.5.12
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: trollop
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
86
|
version: '0'
|
87
87
|
segments:
|
88
88
|
- 0
|
89
|
-
hash:
|
89
|
+
hash: 864178349797000361
|
90
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
91
|
none: false
|
92
92
|
requirements:
|
@@ -95,10 +95,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
segments:
|
97
97
|
- 0
|
98
|
-
hash:
|
98
|
+
hash: 864178349797000361
|
99
99
|
requirements: []
|
100
100
|
rubyforge_project:
|
101
|
-
rubygems_version: 1.8.
|
101
|
+
rubygems_version: 1.8.25
|
102
102
|
signing_key:
|
103
103
|
specification_version: 3
|
104
104
|
summary: Manages users across many different child accounts of a RightScale Enterprise
|