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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 87ecff3bb04b042ba9a49a4554e851add4d434de
4
- data.tar.gz: 464ec5db424d80b2fe59712d493b8d0401d41598
3
+ metadata.gz: c54f906018c0289af53b226e2c727b05316d7804
4
+ data.tar.gz: 80b121d10fbedf271168accbb16d4aa3e4d9bf6a
5
5
  SHA512:
6
- metadata.gz: 834430d0757c6dffd83208127ba461a7954ff2aa22f7e84d4bf9533e90a77e8ad1f8fc3c9c799fc00768d780b7c49894ad2de13c21874455837dbeec261162e9
7
- data.tar.gz: 0b33736468f0fa75e85d3118d9a3715faa1d76c8d8ec9fb97b11921a6fac10de05902af8c096584cc0b9c634a648313e4fa40751e2e3a4f29ab4c4dcdafe9700
6
+ metadata.gz: 2924964157951a54db7916efec203806267910954516e1081559684fb0d3d7e1f52a4cccc18b1bce664db08f2726e44ee190a9e7c53e3d2fa66f828fd6b549cb
7
+ data.tar.gz: 5bf0cb7097e45c2c8665bf53cb2cce2249f8d422f850ca0bfcc73534868889a7b430b95ba864ce0b18e75d8d1958c70fe6f3b23edbe3487b8c2f256aaef6d3d4
@@ -35,6 +35,7 @@ module Opc
35
35
 
36
36
  deps do
37
37
  require 'chef/org'
38
+ require 'chef/org/group_operations'
38
39
  end
39
40
 
40
41
  def run
@@ -29,6 +29,7 @@ module Opc
29
29
 
30
30
  deps do
31
31
  require 'chef/org'
32
+ require 'chef/org/group_operations'
32
33
  end
33
34
 
34
35
  def run
@@ -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
@@ -1,3 +1,3 @@
1
1
  module KnifeOPC
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
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.0
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 00:00:00.000000000 Z
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: []