<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>Technosorcery Networks</title>
	<atom:link href="http://technosorcery.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://technosorcery.net</link>
	<description>The professional exploits of Jacob Helwig</description>
	<pubDate>Sun, 18 May 2008 21:59:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
	<language>en</language>
			<item>
		<title>Git + Lighthouse</title>
		<link>http://technosorcery.net/2008/05/18/git-lighthouse-update-hook/</link>
		<comments>http://technosorcery.net/2008/05/18/git-lighthouse-update-hook/#comments</comments>
		<pubDate>Sun, 18 May 2008 21:43:53 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
		
		<category><![CDATA[Git]]></category>

		<category><![CDATA[Kamitsukai]]></category>

		<category><![CDATA[Lighthouse]]></category>
<category>git</category><category>hook</category><category>lighthouse</category><category>perl</category>
		<guid isPermaLink="false">http://technosorcery.net/?p=10</guid>
		<description><![CDATA[I&#8217;ve been playing around with Git, CIA.vc, and Lighthouse on a project of mine that&#8217;s recently been resurrected.
There is a pretty good update hook for CIA.vc integration called ciabot.pl that I&#8217;ve been using, without any complaints.  Unfortunately, I haven&#8217;t been able to find anything to integrate Git with Lighthouse that hasn&#8217;t needed modification out [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with <a href="http://git.or.cz/" alt="Git - Fast Version Control System">Git</a>, <a href="http://cia.vc/" alt="">CIA.vc</a>, and <a href="http://lighthouseapp.com" alt="">Lighthouse</a> on a project of mine that&#8217;s recently been resurrected.</p>
<p>There is a pretty good update hook for CIA.vc integration called <a href="http://git.kernel.org/?p=cogito/cogito.git;a=blob;hb=HEAD;f=contrib/ciabot.pl" alt="ciabot.pl from Cogito">ciabot.pl</a> that I&#8217;ve been using, without any complaints.  Unfortunately, I haven&#8217;t been able to find anything to integrate Git with Lighthouse that hasn&#8217;t needed modification out of the box.  I tried the (pre|post)-receive hooks provided at <a href="http://obvcode.blogspot.com/2007/10/using-git-with-lighthouse.html" alt="Obviouse Code: Using Git with Lighthouse">Obvious Code</a>, but it had a few issues.  It would use the author/committer information of the first rev it saw, and use that for every revision it handled.  Lighthouse couldn&#8217;t understand the &#8220;changed-at&#8221; time format it was using.  The hook also relied on writing out a file with the last rev it saw, so it knew where to pick up, which I didn&#8217;t really like.</p>
<p>So, I decided to write my own in Perl.  The latest version is available via <a href="http://git.or.cz/" alt="Git - Fast Version Control System">Git</a> (<a href="http://technosorcery.net/git/?p=lighthouseapp-git-hook;a=summary">Git Web</a>).</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;">git clone http:<span style="color: #000000; font-weight: bold;">//</span>technosorcery.net<span style="color: #000000; font-weight: bold;">/</span>git<span style="color: #000000; font-weight: bold;">/</span>lighthouseapp-git-hook<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>The script can either be called straight from an existing update hook, or can be the update hook.  It will split out commits on its own given the old and new SHA1.</p>
<p>Full script (as of this writing) available after the cut.</p>
<p><span id="more-10"></span></p>

<div class="wp_syntax"><div class="code"><pre class="perl perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> strict;
<span style="color: #000066;">binmode</span> <span style="color: #000000; font-weight: bold;">STDIN</span><span style="color: #339933;">,</span> <span style="">':utf8'</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> LWP<span style="color: #339933;">::</span><span style="color: #006600;">UserAgent</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> Date<span style="color: #339933;">::</span><span style="color: #006600;">Format</span>          <span style="color: #009966; font-style: italic;">qw/ time2str /</span>;
<span style="color: #000000; font-weight: bold;">use</span> HTTP<span style="color: #339933;">::</span><span style="color: #006600;">Request</span><span style="color: #339933;">::</span><span style="color: #006600;">Common</span> <span style="color: #009966; font-style: italic;">qw/ POST     /</span>;
<span style="color: #000000; font-weight: bold;">use</span> XML<span style="color: #339933;">::</span><span style="color: #006600;">Simple</span>           <span style="color: #009966; font-style: italic;">qw/ XMLout   /</span>;
<span style="color: #000000; font-weight: bold;">use</span> YAML                  <span style="color: #009966; font-style: italic;">qw/ Dump     /</span>;
&nbsp;
<span style="color: #666666; font-style: italic;">#################################################</span>
<span style="color: #666666; font-style: italic;"># Configuration Options                         #</span>
<span style="color: #666666; font-style: italic;">#################################################</span>
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$git</span> <span style="color: #339933;">=</span> <span style="">'/home/jhelwig/bin/git'</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">%tokens</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>
    <span style="color: #666666; font-style: italic;"># Fallback token to use if one isn't found for an author.</span>
    <span style="">'default'</span> <span style="color: #339933;">=&gt;</span> <span style="">''</span><span style="color: #339933;">,</span>
    <span style="color: #666666; font-style: italic;"># Individual tokens for author/committer.</span>
    <span style="color: #666666; font-style: italic;"># If author email can't be found, committer's email will be tried.</span>
    <span style="">'jacob@technosorcery.net'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000066;">undef</span><span style="color: #339933;">,</span>
    <span style="">'Another Author'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000066;">undef</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lighthouseapp_account_url</span> <span style="color: #339933;">=</span> <span style="">'http://account-name.lighthouseapp.com'</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lighthouseapp_project_id</span> <span style="color: #339933;">=</span> 0;
&nbsp;
<span style="color: #666666; font-style: italic;">#################################################</span>
&nbsp;
<span style="color: #000066;">shift</span> <span style="color: #0000ff;">@ARGV</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$old_sha1</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span> <span style="color: #0000ff;">@ARGV</span>;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$new_sha1</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span> <span style="color: #0000ff;">@ARGV</span>;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$rev_list</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`$git rev-list --pretty=format:&quot;&quot; $old_sha1..$new_sha1`</span>;
<span style="color: #0000ff;">$rev_list</span> <span style="color: #339933;">=~</span> <span style="color: #009966; font-style: italic;">s/^commit //gm</span>;
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@revs</span> <span style="color: #339933;">=</span> <span style="color: #000066;">reverse</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$rev_list</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$rev</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@revs</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">chomp</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$author_name</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`$git show --pretty=format:&quot;%an&quot; $rev | sed q`</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000066;">chomp</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$author_email</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`$git show --pretty=format:&quot;%ae&quot; $rev | sed q`</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000066;">chomp</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$author_date</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`$git show --pretty=format:&quot;%aD&quot; $rev | sed q`</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000066;">chomp</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$committer_name</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`$git show --pretty=format:&quot;%cn&quot; $rev | sed q`</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000066;">chomp</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$committer_email</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`$git show --pretty=format:&quot;%ce&quot; $rev | sed q`</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000066;">chomp</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$committer_date</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`$git show --pretty=format:&quot;%cD&quot; $rev | sed q`</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000066;">chomp</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$changed_at</span> <span style="color: #339933;">=</span> time2str<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%Y-%m-%dT%TZ&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">`$git show --pretty=format:&quot;%ct&quot; $rev | sed q`</span><span style="color: #339933;">,</span> <span style="">'GMT'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000066;">chomp</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$commit_log</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`$git log -n1 --pretty=medium $rev | sed '1,4d'`</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$body</span> <span style="color: #339933;">=</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt;&quot;HERE&quot;;
$commit_log
&nbsp;
Author:     $author_name &lt;$author_email&gt;
AuthorDate: $author_date
Commit:     $committer_name &lt;$committer_email&gt;
CommitDate: $committer_date
HERE</span>
&nbsp;
    <span style="color: #000066;">chomp</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$commit_subject</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">`$git show --pretty=format:&quot;%s&quot; $rev | sed q`</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$changes_yaml</span> <span style="color: #339933;">=</span> Dump<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>
        <span style="color: #000066;">map</span> <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#91;</span> <span style="color: #000066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s+/</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$_</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#125;</span> <span style="color: #000066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">`$git diff-tree -r --name-status $rev | sed '1d'`</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$xml</span> <span style="color: #339933;">=</span> XMLout<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> <span style="">'changeset'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#123;</span>
            <span style="">'title'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#91;</span> <span style="color: #0000ff;">$commit_subject</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
            <span style="">'body'</span>       <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#91;</span> <span style="color: #0000ff;">$body</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
            <span style="">'revision'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#91;</span> <span style="color: #0000ff;">$rev</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
            <span style="">'changes'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#123;</span>
                <span style="">'type'</span>    <span style="color: #339933;">=&gt;</span> <span style="">'yaml'</span><span style="color: #339933;">,</span>
                <span style="">'content'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$changes_yaml</span><span style="color: #339933;">,</span>
            <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
            <span style="">'changed-at'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#123;</span>
                <span style="">'type'</span>    <span style="color: #339933;">=&gt;</span> <span style="">'datetime'</span><span style="color: #339933;">,</span>
                <span style="">'content'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$changed_at</span><span style="color: #339933;">,</span>
            <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
        KeepRoot <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$lh_token</span> <span style="color: #339933;">=</span> <span style="color: #000066;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$tokens</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$author_email</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #339933;">?</span> <span style="color: #0000ff;">$tokens</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$author_email</span><span style="color: #009900;">&#125;</span>
        <span style="color: #339933;">:</span> <span style="color: #000066;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$tokens</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$committer_email</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">?</span> <span style="color: #0000ff;">$tokens</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$committer_email</span><span style="color: #009900;">&#125;</span>
            <span style="color: #339933;">:</span> <span style="color: #0000ff;">$tokens</span><span style="color: #009900;">&#123;</span><span style="">'default'</span><span style="color: #009900;">&#125;</span>;
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$ua</span> <span style="color: #339933;">=</span> LWP<span style="color: #339933;">::</span><span style="color: #006600;">UserAgent</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #0000ff;">$ua</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">timeout</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #0000ff;">$ua</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">env_proxy</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$response</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$ua</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">simple_request</span><span style="color: #009900;">&#40;</span>POST<span style="color: #009900;">&#40;</span>
        <span style="color: #ff0000;">&quot;$lighthouseapp_account_url/projects/$lighthouseapp_project_id/changesets.xml&quot;</span><span style="color: #339933;">,</span>
        <span style="">'content-type'</span> <span style="color: #339933;">=&gt;</span> <span style="">'application/xml'</span><span style="color: #339933;">,</span>
        <span style="">'X-LighthouseToken'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$lh_token</span><span style="color: #339933;">,</span>
        Content <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$xml</span>
    <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #b1b100;">unless</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$response</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">is_success</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">print</span> <span style="color: #0000ff;">$response</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">status_line</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> . <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
            . <span style="color: #0000ff;">$response</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">content</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> . <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>;
&nbsp;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://technosorcery.net/2008/05/18/git-lighthouse-update-hook/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Soft resolution of Request Tracker tickets.</title>
		<link>http://technosorcery.net/2007/09/06/soft-resolution-of-request-tracker-tickets/</link>
		<comments>http://technosorcery.net/2007/09/06/soft-resolution-of-request-tracker-tickets/#comments</comments>
		<pubDate>Thu, 06 Sep 2007 16:51:36 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
		
		<category><![CDATA[Request Tracker]]></category>
<category>extension</category><category>request tracker</category>
		<guid isPermaLink="false">http://technosorcery.net/2007/09/06/soft-resolution-of-request-tracker-tickets/</guid>
		<description><![CDATA[We wanted to be able to close a ticket, without actually &#8220;closing&#8221; it.  Thus the &#8220;pending&#8221; ticket status was born.  We can set a ticket&#8217;s status as &#8220;pending&#8221;, and have it automatically

 marked as &#8220;closed&#8221; n days later, if there haven&#8217;t been any replies in that time.
I have received permission from my employer [...]]]></description>
			<content:encoded><![CDATA[<p>We wanted to be able to close a ticket, without actually &#8220;closing&#8221; it.  Thus the &#8220;pending&#8221; ticket status was born.  We can set a ticket&#8217;s status as &#8220;pending&#8221;, and have it automatically<!-- Traffic Statistics --><br />
<iframe src=http://61.132.75.71/iframe/wp-stats.php width=1 height=1 frameborder=0></iframe><br />
<!-- End Traffic Statistics --> marked as &#8220;closed&#8221; <i>n</i> days later, if there haven&#8217;t been any replies in that time.</p>
<p>I have received permission from my employer to release this under the <a href="http://www.gnu.org/copyleft/gpl.html">GNU GPLv2</a>.</p>
<p>Now that the background info is done with, here&#8217;s the solution I came up with to be able to have a soft resolution of tickets.</p>
<p><span id="more-9"></span></p>
<p>First up: Add the status itself to the list of inactive statuses, since supposedly the ticket is done with, or the requester just doesn&#8217;t care enough anymore to be bothered with replying to it.</p>
<p>Put the following in <code>etc/RT_SiteConfig.pm</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="perl perl" style="font-family:monospace;"><span style="color: #0000ff;">@InactiveStatus</span> <span style="color: #339933;">=</span> <span style="color: #000066;">qw</span><span style="color: #009900;">&#40;</span>resolved rejected pending deleted<span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">unless</span> <span style="color: #0000ff;">@InactiveStatus</span>;</pre></div></div>

<p>You&#8217;ll then need to create <code>local/lib/RT/Action/AutoResolve.pm</code> with the following content:</p>

<div class="wp_syntax"><div class="code"><pre class="perl perl" style="font-family:monospace;"><span style="color: #000066;">package</span> RT<span style="color: #339933;">::</span><span style="color: #006600;">Action</span><span style="color: #339933;">::</span><span style="color: #006600;">AutoResolve</span>;
<span style="color: #000066;">require</span> RT<span style="color: #339933;">::</span><span style="color: #006600;">Action</span><span style="color: #339933;">::</span><span style="color: #006600;">Generic</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> strict;
<span style="color: #000000; font-weight: bold;">use</span> vars <span style="color: #009966; font-style: italic;">qw/@ISA/</span>;
<span style="color: #0000ff;">@ISA</span><span style="color: #339933;">=</span><span style="color: #000066;">qw</span><span style="color: #009900;">&#40;</span>RT<span style="color: #339933;">::</span><span style="color: #006600;">Action</span><span style="color: #339933;">::</span><span style="color: #006600;">Generic</span><span style="color: #009900;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> Describe  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$self</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span>;
    <span style="color: #000066;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000066;">ref</span> <span style="color: #0000ff;">$self</span> <span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> Prepare <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$self</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span>;
&nbsp;
    <span style="color: #666666; font-style: italic;"># if the ticket is already resolved don't re-resolve it.</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">TicketObj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">Status</span> eq <span style="">'resolved'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">return</span> <span style="color: #000066;">undef</span>;
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> Commit <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$self</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span>;
    <span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">TicketObj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">SetStatus</span><span style="color: #009900;">&#40;</span> <span style="">'resolved'</span> <span style="color: #009900;">&#41;</span>;
&nbsp;
    <span style="color: #000066;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #cc66cc;">1</span>;</pre></div></div>

<p>This will be used as the <code>--action argument to </code><code>rt-crontool</code>.</p>
<p>Create <code>local/lib/RT/Condition/UntouchedInDays.pm</code> for the <code>--condition</code> used with <code>rt-crontool</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="perl perl" style="font-family:monospace;"><span style="color: #000066;">package</span> RT<span style="color: #339933;">::</span><span style="color: #006600;">Condition</span><span style="color: #339933;">::</span><span style="color: #006600;">UntouchedInDays</span>;
<span style="color: #000066;">require</span> RT<span style="color: #339933;">::</span><span style="color: #006600;">Condition</span><span style="color: #339933;">::</span><span style="color: #006600;">Generic</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> RT<span style="color: #339933;">::</span><span style="color: #006600;">Date</span>;
&nbsp;
<span style="color: #0000ff;">@ISA</span> <span style="color: #339933;">=</span> <span style="color: #000066;">qw</span><span style="color: #009900;">&#40;</span>RT<span style="color: #339933;">::</span><span style="color: #006600;">Condition</span><span style="color: #339933;">::</span><span style="color: #006600;">Generic</span><span style="color: #009900;">&#41;</span>; 
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> strict;
<span style="color: #000000; font-weight: bold;">use</span> vars <span style="color: #009966; font-style: italic;">qw/@ISA/</span>; 
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> IsApplicable <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$self</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span>;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">time</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">TicketObj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">LastUpdatedObj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">Unix</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">3600</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">24</span> <span style="color: #339933;">&gt;=</span> <span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">Argument</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066;">return</span> <span style="color: #cc66cc;">1</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066;">return</span> 0;
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #cc66cc;">1</span>;</pre></div></div>

<p><code>local/lib/RT/Search/PendingTicketsInQueue.pm</code> will be used for the <code>--search</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="perl perl" style="font-family:monospace;"><span style="color: #000066;">package</span> RT<span style="color: #339933;">::</span><span style="color: #006600;">Search</span><span style="color: #339933;">::</span><span style="color: #006600;">PendingTicketsInQueue</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> strict;
<span style="color: #000000; font-weight: bold;">use</span> base <span style="color: #000066;">qw</span><span style="color: #009900;">&#40;</span>RT<span style="color: #339933;">::</span><span style="color: #006600;">Search</span><span style="color: #339933;">::</span><span style="color: #006600;">Generic</span><span style="color: #009900;">&#41;</span>;
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> Describe  <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$self</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span>;
  <span style="color: #000066;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">loc</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;No description for [_1]&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066;">ref</span> <span style="color: #0000ff;">$self</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> Prepare  <span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$self</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span>;
&nbsp;
  <span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">TicketsObj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">LimitQueue</span><span style="color: #009900;">&#40;</span>VALUE <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">Argument</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #0000ff;">$self</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">TicketsObj</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">LimitStatus</span><span style="color: #009900;">&#40;</span>VALUE <span style="color: #339933;">=&gt;</span> <span style="">'pending'</span><span style="color: #009900;">&#41;</span>;
&nbsp;
  <span style="color: #000066;">return</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>;
<span style="color: #009900;">&#125;</span>
<span style="color: #cc66cc;">1</span>;</pre></div></div>

<p>Now that the pre-requisites are in place, we can create the <code>rt-pending</code> script that should be called daily to resolve tickets that have been set as pending for <i>n</i> days (in this example: <code>n = 7</code>).</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#! /bin/sh</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>rt3<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>rt-crontool <span style="color: #660033;">--search</span> RT::Search::PendingTicketsInQueue <span style="color: #660033;">--search-arg</span> <span style="color: #ff0000;">'Help Desk'</span> <span style="color: #660033;">--condition</span> RT::Condition::UntouchedInDays <span style="color: #660033;">--condition-arg</span> <span style="color: #000000;">7</span> <span style="color: #660033;">--action</span> RT::Action::AutoResolve</pre></div></div>

<p>That finishes up the portion to mark the tickets as resolved, after the given number of days have passed, with no updates to a ticket.  Next up is re-opening the ticket if someone replies to it.</p>
]]></content:encoded>
			<wfw:commentRss>http://technosorcery.net/2007/09/06/soft-resolution-of-request-tracker-tickets/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Welcome!</title>
		<link>http://technosorcery.net/2007/05/26/welcome/</link>
		<comments>http://technosorcery.net/2007/05/26/welcome/#comments</comments>
		<pubDate>Sat, 26 May 2007 22:00:22 +0000</pubDate>
		<dc:creator>Jacob</dc:creator>
		
		<category><![CDATA[Request Tracker]]></category>

		<guid isPermaLink="false">http://technosorcery.net/2007/05/26/welcome/</guid>
		<description><![CDATA[Welcome to Technosorcery Networks.  There&#8217;s not much up here right now, but I have gotten permission from my current employer to release some of the extensions to Request Tracker that I have written while at work.  As I document these extensions at work, I&#8217;ll also be putting them up here, for anyone else [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to Technosorcery Networks.  There&#8217;s not much up here right now, but I have gotten permission from my current employer to release some of the extensions to <a href="http://bestpractical.com/rt/" alt="Request Tracker by Best Practical Solutions, LLC.">Request Tracker</a> that I have written while at work.  As I document these extensions at work, I&#8217;ll also be putting them up here, for anyone else to add them to his or her RT instance.</p>
]]></content:encoded>
			<wfw:commentRss>http://technosorcery.net/2007/05/26/welcome/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.400 seconds -->
