{"id":60,"date":"2008-02-05T12:26:30","date_gmt":"2008-02-05T17:26:30","guid":{"rendered":"http:\/\/blogs.cae.tntech.edu\/mwr\/2008\/02\/05\/stupid-puppet-trick-agreeing-to-the-sun-java-license-with-debconf-preseeds-and-puppet\/"},"modified":"2024-10-27T14:26:19","modified_gmt":"2024-10-27T14:26:19","slug":"stupid-puppet-trick-agreeing-to-the-sun-java-license-with-debconf-preseeds-and-puppet","status":"publish","type":"post","link":"https:\/\/sites.tntech.edu\/renfro\/2008\/02\/05\/stupid-puppet-trick-agreeing-to-the-sun-java-license-with-debconf-preseeds-and-puppet\/","title":{"rendered":"Stupid Puppet Trick: Agreeing to the Sun Java License with Debconf Preseeds and Puppet"},"content":{"rendered":"<p>I had a user ask for Java to be installed on the cluster systems, so I started up by making a simple JRE5 module for puppet, but this first one didn&#8217;t quite work:<\/p>\n<pre>\nclass jre5 {\n  package { \"sun-java5-jre\":\n    ensure =&gt; latest;\n  }\n}\n<\/pre>\n<p>It doesn&#8217;t work because Sun wants you to agree to its license before installing the JRE. There&#8217;s a couple of ways around this. First, the old-school method:<\/p>\n<pre>\nssh host \"yes | apt-get -y install sun-java5-jre\"\n<\/pre>\n<p>where &#8216;yes&#8217; is a standard Unix program that just prints out &#8220;yes&#8221; over and over until the program on the other side of the pipe terminates. But &#8220;ssh host foo&#8221; is not the way of the managed infrastructure. <\/p>\n<p>The second method, much more friendly to centralized management, is to first install debconf-utils on a candidate system, and then install sun-java5-jre on the same system. Once that&#8217;s done, you can query the debconf database to see how it stored your answers to the Sun license agreement:<\/p>\n<pre>\nch226-12:~# debconf-get-selections | grep sun-\nsun-java5-bin   shared\/accepted-sun-dlj-v1-1    boolean true\nsun-java5-jre   shared\/accepted-sun-dlj-v1-1    boolean true\nsun-java5-jre   sun-java5-jre\/jcepolicy note\nsun-java5-jre   sun-java5-jre\/stopthread        boolean true\nsun-java5-bin   shared\/error-sun-dlj-v1-1       error\nsun-java5-jre   shared\/error-sun-dlj-v1-1       error\nsun-java5-bin   shared\/present-sun-dlj-v1-1     note\nsun-java5-jre   shared\/present-sun-dlj-v1-1     note\n<\/pre>\n<p>Save those results (debconf seeds) into a file on the gold server. Then we can modify our jre5 class as follows:<\/p>\n<pre>\nclass jre5 {\n  package { \"sun-java5-jre\":\n    require      =&gt; File[\"\/var\/cache\/debconf\/jre5.seeds\"],\n    responsefile =&gt; \"\/var\/cache\/debconf\/jre5.seeds\",\n    ensure       =&gt; latest;\n  }\n\n  file { \"\/var\/cache\/debconf\/jre5.seeds\":\n    source =&gt; \"puppet:\/\/\/jre5\/jre5.seeds\",\n    ensure =&gt; present;\n  }\n}\n<\/pre>\n<p>Now our class will download the preseeded answers for the Java license, download and install the JRE, and then use the preseeded answers to skip past the license agreement. I had never messed with debconf seeding previously, since I had either just imaged my systems, or provided config files that would be used when I restarted any daemons or programs that depended on those files. Now debconf-utils is part of my standard system class definition.<\/p>\n<p>Note that this method doesn&#8217;t work with the default puppet provided in Debian Etch (version 0.20) &#8212; the responsefile parameter for Debian packages was only added in puppet 0.22.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had a user ask for Java to be installed on the cluster systems, so I started up by making a simple JRE5 module for puppet, but this first one didn&#8217;t quite work: class jre5 { package { &#8220;sun-java5-jre&#8221;: ensure =&gt; latest; } } It doesn&#8217;t work because Sun wants you to agree to its &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/sites.tntech.edu\/renfro\/2008\/02\/05\/stupid-puppet-trick-agreeing-to-the-sun-java-license-with-debconf-preseeds-and-puppet\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Stupid Puppet Trick: Agreeing to the Sun Java License with Debconf Preseeds and Puppet&#8221;<\/span><\/a><\/p>\n","protected":false},"author":87,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,7,16],"tags":[],"class_list":["post-60","post","type-post","status-publish","format-standard","hentry","category-debian","category-infrastructures","category-puppet","entry"],"_links":{"self":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/posts\/60","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/users\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/comments?post=60"}],"version-history":[{"count":1,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":472,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/posts\/60\/revisions\/472"}],"wp:attachment":[{"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.tntech.edu\/renfro\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}