diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-04-14 13:46:12 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-04-14 13:46:12 +0000 |
commit | 1be510f9529cb082f802408b472a77d074b394c0 (patch) | |
tree | b175f9d5fcb107576dabc768e7bd04d4a3e491a0 /zarb-ml/mageia-sysadm/attachments/20110721 | |
parent | fa5098cf210b23ab4f419913e28af7b1b07dafb2 (diff) | |
download | archives-1be510f9529cb082f802408b472a77d074b394c0.tar archives-1be510f9529cb082f802408b472a77d074b394c0.tar.gz archives-1be510f9529cb082f802408b472a77d074b394c0.tar.bz2 archives-1be510f9529cb082f802408b472a77d074b394c0.tar.xz archives-1be510f9529cb082f802408b472a77d074b394c0.zip |
Diffstat (limited to 'zarb-ml/mageia-sysadm/attachments/20110721')
6 files changed, 192 insertions, 0 deletions
diff --git a/zarb-ml/mageia-sysadm/attachments/20110721/271a32a4/attachment-0001.bin b/zarb-ml/mageia-sysadm/attachments/20110721/271a32a4/attachment-0001.bin new file mode 100644 index 000000000..55e85a67f --- /dev/null +++ b/zarb-ml/mageia-sysadm/attachments/20110721/271a32a4/attachment-0001.bin @@ -0,0 +1,28 @@ +# proprieté +# nom -> +# url -> +# enabled ? +# login +# pass +# virtual +# +Puppet::Type.newtype(:mandriva_repository) do + @doc = "Manage mandriva repository" + + ensurable + + newparam(:name) do + desc "The name of the repository" + isnamevar + end + + newproperty(:url) do + desc "The url of the repository" + end + + newproperty(:enabled) do + desc "If set, media will be enabled by default" + defaultto :true + newvalues(:true, :false) + end +end diff --git a/zarb-ml/mageia-sysadm/attachments/20110721/271a32a4/attachment-0002.bin b/zarb-ml/mageia-sysadm/attachments/20110721/271a32a4/attachment-0002.bin new file mode 100644 index 000000000..d988365d6 --- /dev/null +++ b/zarb-ml/mageia-sysadm/attachments/20110721/271a32a4/attachment-0002.bin @@ -0,0 +1,46 @@ +require 'puppet' +# provide is still unclear +Puppet::Type.type(:mandriva_repository).provide(:urpmi_managed) do + commands :urpmi_addmedia => "/usr/sbin/urpmi.addmedia", + :urpmi_removemedia => "/usr/sbin/urpmi.removemedia", + :urpmq => "/usr/bin/urpmq" + + def create + if exists? + info "already exists" + return nil + end + + begin + execute([:urpmi_addmedia, @resource[:name], @resource[:url]]) + rescue Puppet::ExecutionFailure => detail + raise Puppet::Error, "Could not create %s %s: %s" % + [@resource.class.name, @resource.name, detail] + end + + # faire un urpmi.addmedia + end + + def destroy + unless exists? + info "already absent" + return nil + end + + begin + execute([:urpmi_removemedia, @resource[:name] ]) + rescue Puppet::ExecutionFailure => detail + raise Puppet::Error, "Could not remove %s %s: %s" % + [@resource.class.name, @resource.name, detail] + end + end + + def exists? + f = IO.popen('urpmq --list-media') + while (l = f.gets) + # http://codelikezell.com/how-to-use-ruby-variables-in-regular-expressions/ + return true if (l =~ /^#{@resource[:name]}$/) + end + return nil + end +end diff --git a/zarb-ml/mageia-sysadm/attachments/20110721/271a32a4/attachment-0003.bin b/zarb-ml/mageia-sysadm/attachments/20110721/271a32a4/attachment-0003.bin new file mode 100644 index 000000000..55e85a67f --- /dev/null +++ b/zarb-ml/mageia-sysadm/attachments/20110721/271a32a4/attachment-0003.bin @@ -0,0 +1,28 @@ +# proprieté +# nom -> +# url -> +# enabled ? +# login +# pass +# virtual +# +Puppet::Type.newtype(:mandriva_repository) do + @doc = "Manage mandriva repository" + + ensurable + + newparam(:name) do + desc "The name of the repository" + isnamevar + end + + newproperty(:url) do + desc "The url of the repository" + end + + newproperty(:enabled) do + desc "If set, media will be enabled by default" + defaultto :true + newvalues(:true, :false) + end +end diff --git a/zarb-ml/mageia-sysadm/attachments/20110721/271a32a4/attachment.bin b/zarb-ml/mageia-sysadm/attachments/20110721/271a32a4/attachment.bin new file mode 100644 index 000000000..d988365d6 --- /dev/null +++ b/zarb-ml/mageia-sysadm/attachments/20110721/271a32a4/attachment.bin @@ -0,0 +1,46 @@ +require 'puppet' +# provide is still unclear +Puppet::Type.type(:mandriva_repository).provide(:urpmi_managed) do + commands :urpmi_addmedia => "/usr/sbin/urpmi.addmedia", + :urpmi_removemedia => "/usr/sbin/urpmi.removemedia", + :urpmq => "/usr/bin/urpmq" + + def create + if exists? + info "already exists" + return nil + end + + begin + execute([:urpmi_addmedia, @resource[:name], @resource[:url]]) + rescue Puppet::ExecutionFailure => detail + raise Puppet::Error, "Could not create %s %s: %s" % + [@resource.class.name, @resource.name, detail] + end + + # faire un urpmi.addmedia + end + + def destroy + unless exists? + info "already absent" + return nil + end + + begin + execute([:urpmi_removemedia, @resource[:name] ]) + rescue Puppet::ExecutionFailure => detail + raise Puppet::Error, "Could not remove %s %s: %s" % + [@resource.class.name, @resource.name, detail] + end + end + + def exists? + f = IO.popen('urpmq --list-media') + while (l = f.gets) + # http://codelikezell.com/how-to-use-ruby-variables-in-regular-expressions/ + return true if (l =~ /^#{@resource[:name]}$/) + end + return nil + end +end diff --git a/zarb-ml/mageia-sysadm/attachments/20110721/7ba3be94/attachment-0001.bin b/zarb-ml/mageia-sysadm/attachments/20110721/7ba3be94/attachment-0001.bin new file mode 100644 index 000000000..05fe9dec4 --- /dev/null +++ b/zarb-ml/mageia-sysadm/attachments/20110721/7ba3be94/attachment-0001.bin @@ -0,0 +1,22 @@ +Index: modules/mirror/manifests/init.pp +=================================================================== +--- modules/mirror/manifests/init.pp (révision 1894) ++++ modules/mirror/manifests/init.pp (copie de travail) +@@ -49,7 +49,7 @@ + + cron { "mirror_$name": + user => mirror, +- minute => [0, 10, 20, 30, 40, 50], ++ minute => '*/10', + command => "$bindir/mirror_$name", + require => File["mirror_$name"], + } +@@ -68,7 +68,7 @@ + + cron { mirror: + user => mirror, +- minute => [0, 10, 20, 30, 40, 50], ++ minute => '*/10', + command => "$bindir/update_timestamp", + require => File["update_timestamp"], + }
\ No newline at end of file diff --git a/zarb-ml/mageia-sysadm/attachments/20110721/7ba3be94/attachment.bin b/zarb-ml/mageia-sysadm/attachments/20110721/7ba3be94/attachment.bin new file mode 100644 index 000000000..05fe9dec4 --- /dev/null +++ b/zarb-ml/mageia-sysadm/attachments/20110721/7ba3be94/attachment.bin @@ -0,0 +1,22 @@ +Index: modules/mirror/manifests/init.pp +=================================================================== +--- modules/mirror/manifests/init.pp (révision 1894) ++++ modules/mirror/manifests/init.pp (copie de travail) +@@ -49,7 +49,7 @@ + + cron { "mirror_$name": + user => mirror, +- minute => [0, 10, 20, 30, 40, 50], ++ minute => '*/10', + command => "$bindir/mirror_$name", + require => File["mirror_$name"], + } +@@ -68,7 +68,7 @@ + + cron { mirror: + user => mirror, +- minute => [0, 10, 20, 30, 40, 50], ++ minute => '*/10', + command => "$bindir/update_timestamp", + require => File["update_timestamp"], + }
\ No newline at end of file |