mirror of https://github.com/zulip/zulip.git
puppet: Reformat custom Ruby modules with Rufo.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
81ffc4e827
commit
29e4c71ec4
|
@ -2,8 +2,8 @@ module Puppet::Parser::Functions
|
||||||
newfunction(:zulipconf, :type => :rvalue, :arity => -2) do |args|
|
newfunction(:zulipconf, :type => :rvalue, :arity => -2) do |args|
|
||||||
default = args.pop
|
default = args.pop
|
||||||
joined = args.join(" ")
|
joined = args.join(" ")
|
||||||
zulip_conf_path = lookupvar('zulip_conf_path')
|
zulip_conf_path = lookupvar("zulip_conf_path")
|
||||||
output = `/usr/bin/crudini --get #{zulip_conf_path} #{joined} 2>&1`; result=$?.success?
|
output = `/usr/bin/crudini --get #{zulip_conf_path} #{joined} 2>&1`; result = $?.success?
|
||||||
if result
|
if result
|
||||||
output.strip()
|
output.strip()
|
||||||
else
|
else
|
||||||
|
@ -12,8 +12,8 @@ module Puppet::Parser::Functions
|
||||||
end
|
end
|
||||||
|
|
||||||
newfunction(:zulipconf_keys, :type => :rvalue, :arity => 1) do |args|
|
newfunction(:zulipconf_keys, :type => :rvalue, :arity => 1) do |args|
|
||||||
zulip_conf_path = lookupvar('zulip_conf_path')
|
zulip_conf_path = lookupvar("zulip_conf_path")
|
||||||
output = `/usr/bin/crudini --get #{zulip_conf_path} #{args[0]} 2>&1`; result=$?.success?
|
output = `/usr/bin/crudini --get #{zulip_conf_path} #{args[0]} 2>&1`; result = $?.success?
|
||||||
if result
|
if result
|
||||||
return output.lines.map { |l| l.strip }
|
return output.lines.map { |l| l.strip }
|
||||||
else
|
else
|
||||||
|
@ -25,14 +25,14 @@ module Puppet::Parser::Functions
|
||||||
section = "nagios"
|
section = "nagios"
|
||||||
prefix = "hosts_"
|
prefix = "hosts_"
|
||||||
ignore_key = "hosts_fullstack"
|
ignore_key = "hosts_fullstack"
|
||||||
zulip_conf_path = lookupvar('zulip_conf_path')
|
zulip_conf_path = lookupvar("zulip_conf_path")
|
||||||
keys = `/usr/bin/crudini --get #{zulip_conf_path} #{section} 2>&1`; result=$?.success?
|
keys = `/usr/bin/crudini --get #{zulip_conf_path} #{section} 2>&1`; result = $?.success?
|
||||||
if result
|
if result
|
||||||
keys = keys.lines.map { |l| l.strip }
|
keys = keys.lines.map { |l| l.strip }
|
||||||
filtered_keys = keys.select { |l| l.start_with?(prefix) }.reject { |k| k == ignore_key }
|
filtered_keys = keys.select { |l| l.start_with?(prefix) }.reject { |k| k == ignore_key }
|
||||||
all_values = []
|
all_values = []
|
||||||
filtered_keys.each do |key|
|
filtered_keys.each do |key|
|
||||||
values = `/usr/bin/crudini --get #{zulip_conf_path} #{section} #{key} 2>&1`; result=$?.success?
|
values = `/usr/bin/crudini --get #{zulip_conf_path} #{section} #{key} 2>&1`; result = $?.success?
|
||||||
if result
|
if result
|
||||||
all_values += values.strip.split(/,\s*/)
|
all_values += values.strip.split(/,\s*/)
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ module Puppet::Parser::Functions
|
||||||
newfunction(:zulipsecret, :type => :rvalue) do |args|
|
newfunction(:zulipsecret, :type => :rvalue) do |args|
|
||||||
default = args.pop
|
default = args.pop
|
||||||
joined = args.join(" ")
|
joined = args.join(" ")
|
||||||
output = `/usr/bin/crudini --get /etc/zulip/zulip-secrets.conf #{joined} 2>&1`; result=$?.success?
|
output = `/usr/bin/crudini --get /etc/zulip/zulip-secrets.conf #{joined} 2>&1`; result = $?.success?
|
||||||
if result
|
if result
|
||||||
output.strip()
|
output.strip()
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
Puppet::Type.newtype(:apache2conf) do
|
Puppet::Type.newtype(:apache2conf) do
|
||||||
ensurable
|
ensurable
|
||||||
newparam(:name) do
|
newparam(:name) do
|
||||||
desc "The name of the conf to enable"
|
desc "The name of the conf to enable"
|
||||||
isnamevar
|
isnamevar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Puppet::Type.type(:apache2conf).provide(:apache2conf) do
|
Puppet::Type.type(:apache2conf).provide(:apache2conf) do
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
Puppet::Type.newtype(:apache2mod) do
|
Puppet::Type.newtype(:apache2mod) do
|
||||||
ensurable
|
ensurable
|
||||||
newparam(:name) do
|
newparam(:name) do
|
||||||
desc "The name of the module to enable"
|
desc "The name of the module to enable"
|
||||||
isnamevar
|
isnamevar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Puppet::Type.type(:apache2mod).provide(:apache2mod) do
|
Puppet::Type.type(:apache2mod).provide(:apache2mod) do
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
Puppet::Type.newtype(:apache2site) do
|
Puppet::Type.newtype(:apache2site) do
|
||||||
ensurable
|
ensurable
|
||||||
newparam(:name) do
|
newparam(:name) do
|
||||||
desc "The name of the site to enable"
|
desc "The name of the site to enable"
|
||||||
isnamevar
|
isnamevar
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Puppet::Type.type(:apache2site).provide(:apache2site) do
|
Puppet::Type.type(:apache2site).provide(:apache2site) do
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
Puppet::Type.newtype(:chroot) do
|
Puppet::Type.newtype(:chroot) do
|
||||||
ensurable
|
ensurable
|
||||||
newparam(:release) do
|
newparam(:release) do
|
||||||
desc "The name of the release"
|
desc "The name of the release"
|
||||||
isnamevar
|
isnamevar
|
||||||
end
|
end
|
||||||
newparam(:distro) do
|
newparam(:distro) do
|
||||||
desc "The name of the Linux distribution (Debian, Ubuntu)"
|
desc "The name of the Linux distribution (Debian, Ubuntu)"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Puppet::Type.type(:chroot).provide(:chroot) do
|
Puppet::Type.type(:chroot).provide(:chroot) do
|
||||||
|
@ -16,12 +16,12 @@ Puppet::Type.type(:chroot).provide(:chroot) do
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if @resource[:distro] == "ubuntu"
|
if @resource[:distro] == "ubuntu"
|
||||||
mirror = "http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive/"
|
mirror = "http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive/"
|
||||||
else
|
else
|
||||||
mirror = "http://mirror.cc.columbia.edu/debian"
|
mirror = "http://mirror.cc.columbia.edu/debian"
|
||||||
end
|
end
|
||||||
["amd64", "i386"].each { |x|
|
["amd64", "i386"].each { |x|
|
||||||
system("mk-sbuild #{@resource[:release]} --arch=#{x} --debootstrap-mirror=#{mirror} --distro=#{@resource[:distro]}")
|
system("mk-sbuild #{@resource[:release]} --arch=#{x} --debootstrap-mirror=#{mirror} --distro=#{@resource[:distro]}")
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue