knife-opc 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/knife/opc_org_create.rb +1 -0
- data/lib/chef/knife/opc_org_user_add.rb +1 -0
- data/lib/chef/org.rb +2 -12
- data/lib/chef/org/group_operations.rb +20 -0
- data/lib/chef/org/group_operations.rb~ +21 -0
- data/lib/knife-opc/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c54f906018c0289af53b226e2c727b05316d7804
|
4
|
+
data.tar.gz: 80b121d10fbedf271168accbb16d4aa3e4d9bf6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2924964157951a54db7916efec203806267910954516e1081559684fb0d3d7e1f52a4cccc18b1bce664db08f2726e44ee190a9e7c53e3d2fa66f828fd6b549cb
|
7
|
+
data.tar.gz: 5bf0cb7097e45c2c8665bf53cb2cce2249f8d422f850ca0bfcc73534868889a7b430b95ba864ce0b18e75d8d1958c70fe6f3b23edbe3487b8c2f256aaef6d3d4
|
data/lib/chef/org.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'chef/json_compat'
|
2
2
|
require 'chef/mixin/params_validate'
|
3
3
|
require 'chef/rest'
|
4
|
+
require 'chef/org/group_operations'
|
4
5
|
|
5
6
|
class Chef
|
6
7
|
class Org
|
7
8
|
|
8
9
|
include Chef::Mixin::ParamsValidate
|
10
|
+
include Chef::Org::GroupOperations
|
9
11
|
|
10
12
|
def initialize(name='')
|
11
13
|
@name = name
|
@@ -93,18 +95,6 @@ class Chef
|
|
93
95
|
chef_rest.delete_rest "organizations/#{name}/users/#{username}"
|
94
96
|
end
|
95
97
|
|
96
|
-
def add_user_to_group(groupname, username)
|
97
|
-
group = chef_rest.get_rest "organizations/#{name}/groups/#{groupname}"
|
98
|
-
body_hash = {
|
99
|
-
:groupname => "#{groupname}",
|
100
|
-
:actors => {
|
101
|
-
"users" => group["actors"].concat([username]),
|
102
|
-
"groups" => group["groups"]
|
103
|
-
}
|
104
|
-
}
|
105
|
-
chef_rest.put_rest "organizations/#{name}/groups/#{groupname}", body_hash
|
106
|
-
end
|
107
|
-
|
108
98
|
# Class methods
|
109
99
|
def self.from_hash(org_hash)
|
110
100
|
org = Chef::Org.new
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'chef/org'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Org
|
5
|
+
module GroupOperations
|
6
|
+
def add_user_to_group(groupname, username)
|
7
|
+
group = chef_rest.get_rest "organizations/#{name}/groups/#{groupname}"
|
8
|
+
body_hash = {
|
9
|
+
:groupname => "#{groupname}",
|
10
|
+
:actors => {
|
11
|
+
"users" => group["actors"].concat([username]),
|
12
|
+
"groups" => group["groups"]
|
13
|
+
}
|
14
|
+
}
|
15
|
+
chef_rest.put_rest "organizations/#{name}/groups/#{groupname}", body_hash
|
16
|
+
end
|
17
|
+
end
|
18
|
+
include Chef::Org::GroupOperations
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'chef/org'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Org
|
5
|
+
module GroupOperations
|
6
|
+
def add_user_to_group(groupname, username)
|
7
|
+
group = chef_rest.get_rest "organizations/#{name}/groups/#{groupname}"
|
8
|
+
body_hash = {
|
9
|
+
:groupname => "#{groupname}",
|
10
|
+
:actors => {
|
11
|
+
"users" => group["actors"].concat([username]),
|
12
|
+
"groups" => group["groups"]
|
13
|
+
}
|
14
|
+
}
|
15
|
+
chef_rest.put_rest "organizations/#{name}/groups/#{groupname}", body_hash
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
include Chef::Org::GroupOperations
|
21
|
+
end
|
data/lib/knife-opc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-opc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Danna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -91,6 +91,8 @@ files:
|
|
91
91
|
- lib/chef/knife/opc_user_password.rb
|
92
92
|
- lib/chef/knife/opc_user_show.rb
|
93
93
|
- lib/chef/org.rb
|
94
|
+
- lib/chef/org/group_operations.rb
|
95
|
+
- lib/chef/org/group_operations.rb~
|
94
96
|
- lib/knife-opc/version.rb
|
95
97
|
homepage: http://wiki.opscode.com/display/chef
|
96
98
|
licenses: []
|