Skip to content

Instantly share code, notes, and snippets.

@fatmcgav
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatmcgav/8864343 to your computer and use it in GitHub Desktop.
Save fatmcgav/8864343 to your computer and use it in GitHub Desktop.
Autorequire resource inspection
# Autorequire the domain resource
autorequire(:domain) do
self.catalog.resources.select { |res|
# pseudo-code: resource is of desired type
# # and has desired properties/parameters
debug ("Res = #{res}. Type = #{res.type}, Type.class = #{res.type.class}")
next unless res.type == :domain
debug ("Got a domain res: #{res}")
debug ("Postbase = #{res[:portbase]}")
res if res[:portbase] == self[:portbase]
#debug (res.parameters.inspect)
}.collect { |res|
debug ("Got res: #{res}")
res[:name]
}
end
Debug: /Stage[main]//Application[hello]: Res = Exec[unzip-downloaded]. Type = exec, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Exec[download_glassfish-3.1.2.2.zip]. Type = exec, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Service[glassfish_test]. Type = service, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Glassfish::Create_domain[test]. Type = component, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Class[Main]. Type = component, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Class[Glassfish::Params]. Type = component, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Application[hello]. Type = application, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = File[test_servicefile]. Type = file, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Exec[change-mode]. Type = exec, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Class[Glassfish]. Type = component, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = File[/etc/profile.d/glassfish.sh]. Type = file, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = File[remove-domain1]. Type = file, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Schedule[daily]. Type = schedule, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Exec[stop_test]. Type = exec, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Package[unzip]. Type = package, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Group[glassfish]. Type = group, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Filebucket[puppet]. Type = filebucket, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Schedule[monthly]. Type = schedule, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Schedule[weekly]. Type = schedule, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Glassfish::Create_service[test]. Type = component, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Exec[change-ownership]. Type = exec, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Stage[main]. Type = stage, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Class[Glassfish::Java]. Type = component, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = File[/usr/local]. Type = file, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Class[Settings]. Type = component, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Schedule[hourly]. Type = schedule, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Class[Glassfish::Path]. Type = component, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = File[/tmp/asadmin.pass]. Type = file, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Domain[test]. Type = domain, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Got a domain res: Domain[test]
Debug: /Stage[main]//Application[hello]: Postbase = 8000
Debug: /Stage[main]//Application[hello]: Res = Schedule[puppet]. Type = schedule, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Class[Glassfish::Install]. Type = component, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Jvmoption[-Xrs]. Type = jvmoption, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Package[java-1.6.0-openjdk-devel]. Type = package, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Exec[move-glassfish3]. Type = exec, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = User[glassfish]. Type = user, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = Schedule[never]. Type = schedule, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Res = File[/tmp]. Type = file, Type.class = Symbol
Debug: /Stage[main]//Application[hello]: Got res: Domain[test]
Debug: /Stage[main]//Application[hello]: Autorequiring Domain[test]
Debug: /Stage[main]//Application[hello]: Autorequiring User[glassfish]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment