summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-09-15 04:48:11 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2005-09-15 04:48:11 +0000
commit610f95caa41c3bc641676b401887f361978a7dbb (patch)
tree2db7138401e24a125a24065dd3d6cda9aeb76cb1
parent2a6710b22d8cfd1d5a64af320e8b7d2ff9a998cc (diff)
downloadpuppet-610f95caa41c3bc641676b401887f361978a7dbb.tar.gz
puppet-610f95caa41c3bc641676b401887f361978a7dbb.tar.xz
puppet-610f95caa41c3bc641676b401887f361978a7dbb.zip
switching groups back to having namevar be a parameter instead of a state
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@661 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xlib/puppet/type/group.rb17
-rwxr-xr-xtest/types/tc_group.rb24
2 files changed, 23 insertions, 18 deletions
diff --git a/lib/puppet/type/group.rb b/lib/puppet/type/group.rb
index 93c8d9ba3..6278d7f55 100755
--- a/lib/puppet/type/group.rb
+++ b/lib/puppet/type/group.rb
@@ -217,7 +217,11 @@ module Puppet
def sync
events = []
- if self.name == :name
+ unless @parent.exists?
+ events << syncname()
+ end
+
+ if @should == :notfound
return syncname()
end
obj = @parent.getinfo
@@ -248,7 +252,8 @@ module Puppet
GroupNInfo.flush()
- return :group_modified
+ events << :group_modified
+ return events
end
private
@@ -298,7 +303,6 @@ module Puppet
class Type
class Group < Type
@states = [
- Puppet::State::GroupName,
Puppet::State::GroupGID
]
@@ -330,7 +334,12 @@ module Puppet
end
}
- @parameters = []
+ @parameters = [:name]
+
+ @paramdoc[:name] = "The group name. While naming limitations vary by
+ system, it is advisable to keep the name to the degenerate
+ limitations, which is a maximum of 8 characters beginning with
+ a letter."
@doc = "Manage groups. This type can only create groups. Group
membership must be managed on individual users."
diff --git a/test/types/tc_group.rb b/test/types/tc_group.rb
index 2fbdeb4d8..c2288fc3d 100755
--- a/test/types/tc_group.rb
+++ b/test/types/tc_group.rb
@@ -24,13 +24,7 @@ class TestGroup < TestPuppet
end
@@tmpgroups.each { |group|
unless missing?(group)
- # if we've gotten this far, the group exists, so remove it
- Puppet.info "Cleaning %s" % group
- group = Puppet::Type::Group.new(
- :name => group
- )
- group[:name] = :notfound
- group.state(:name).sync
+ remove(group)
end
}
super
@@ -60,6 +54,10 @@ class TestGroup < TestPuppet
return nil
end
+
+ def remove(group)
+ system("niutil -destroy / /groups/%s" % group)
+ end
else
def missing?(group)
begin
@@ -78,6 +76,10 @@ class TestGroup < TestPuppet
return nil
end
+
+ def remove(group)
+ system("groupdel %s" % group)
+ end
end
def groupnames
@@ -238,13 +240,7 @@ class TestGroup < TestPuppet
end
}
- es = nil
- if os == "Darwin"
- es = [:group_modified, :group_deleted]
- else
- es = [:group_deleted]
- end
- assert_rollback_events(trans, es, "group")
+ assert_rollback_events(trans, [:group_deleted], "group")
assert(missing?(name), "Group %s is still present" % name)
end