<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Mac Systems Admin and new Dad</description><title>unimplemented trap</title><generator>Tumblr (3.0; @lashomb)</generator><link>http://lashomb.tumblr.com/</link><item><title>Migrating from Posterous to Flickr</title><description>&lt;p&gt;I have a Posterous blog to post pictures and videos of my kids so the Grandparents can see them. When I signed up for Posterous, the agreement said you own the data. They haven&amp;#8217;t changed that (yet), but seeing how the evil Twitter overlords are treating their developers, I don&amp;#8217;t want to find out too late in the game.&lt;/p&gt;

&lt;p&gt;Our site has just short of 3000 posts, containing both photos and video. We also have a Flickr Pro account, but at the time I set it up in early 2008, Flickr didn&amp;#8217;t have video hosting yet. I don&amp;#8217;t think Posterous had autopost to Flickr yet anyway, but I don&amp;#8217;t remember. Needless to say, I never turned it on.&lt;/p&gt;

&lt;p&gt;So now I&amp;#8217;m stuck trying to get data off of Posterous. I tried several autoimports from Wordpress and Squarespace, but the APIs must have changed and there are problems. Wordpress took theirs down to fix it, and when I used the SquareSpace import, all my photos came in sideways.&lt;/p&gt;

&lt;p&gt;I looked into autopost, thinking I could script it to move it to another site. But when I tested Wordpress, it only linked back to the original on Posterous, leaving my data in the hands of the aforementioned evil Twitter overlords.&lt;/p&gt;

&lt;p&gt;I tested Flickr&amp;#8230; and success! It uploaded the image to Flickr. Now how to automate this. I found a &lt;a href="https://github.com/blocke/Posterous-Backup" target="_blank"&gt;posterous backup script&lt;/a&gt; on github (edit for your hostname and backup directory path), and was able to successful get the XML, but many of the media downloads failed. When looking into the autopost functionality, I noticed a common URL structure for it.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&lt;a href="http://posterous.com/posts/autopost/000000000?external=11111" target="_blank"&gt;http://posterous.com/posts/autopost/000000000?external=11111&lt;/a&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In that example string, the zeroes are the post ID, and the ones are the source we&amp;#8217;re exporting too. Armed with that knowledge we now have to get the media IDs out of the XML files.&lt;/p&gt;

&lt;p&gt;OS X now has a program called xmllint. I don&amp;#8217;t know when they got this, but we&amp;#8217;re going to use it to strip out only the contents of the id tag. First concatenate all your XML files pulled from the posterus_backup.py script into one file.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;cat page* &amp;gt; collectedxml.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we&amp;#8217;ll run xmllint on the XML file. This will strip out the contents of the id tag, and clean it up.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;echo "cat  //id/text()" | xmllint --shell collectedxml.xml | egrep '^\w' &amp;gt;&amp;gt; media_ids.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we&amp;#8217;ve got all the media IDs inside the file media_ids.txt, each on it&amp;#8217;s own line. I tried using a shell variable to complete the URL and hit it via curl, but as you need to be logged into Posterous, I couldn&amp;#8217;t make it work. So I tried AppleScript.&lt;/p&gt;

&lt;p&gt;I found a script on &lt;a href="http://stackoverflow.com/questions/7715113/applescript-how-to-loop-through-list-of-urls-one-at-a-time-to-open-close-a-br" target="_blank"&gt;StackExchange&lt;/a&gt; that will open a file with URLs in it, line by line and then close them. Bingo!&lt;/p&gt;

&lt;p&gt;Only my file doesn&amp;#8217;t contain complete URLs, it only has IDs. We&amp;#8217;ll use sed to append the needed text before and after the ID. (Be sure to replace 111111 with the ID for your external source (drag an autopost link from a Posterous post into the location bar in your browser, and you&amp;#8217;ll see it).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sed 's/^/http:\/\/posterous.com\/posts\/autopost\//g;s/$/?external=111111/g' media_ids.txt &amp;gt; media_urls.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we have a file with complete autopost URLs on each line. Let&amp;#8217;s look at the AppleScript. The JavaScript check was glitchy for me, so I used a different method to check for the text on the page when it&amp;#8217;s loaded. If it can&amp;#8217;t find the text, the page hasn&amp;#8217;t finished loading and it doesn&amp;#8217;t close the window.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;set thePath to (path to desktop as Unicode text) &amp;amp; "media_urls.txt"
set theFile to (open for access file thePath)
set theContent to (read theFile)
close access theFile

set theURLs to every paragraph of theContent


tell application "Safari"
    repeat with theURL in theURLs
        make new document
        set URL of front document to theURL
        delay 2
        set PageText to the text of front document
        if PageText contains "Flickr" then close front document
    end repeat
end tell&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I copied this into a new document in AppleScript Editor, and saved my media_urls.txt to my ~/Desktop folder. Click Run. If you have 3000 images/videos to migrate like me, it will take a while. But at least it will be out of the hands of the evil Twitter Overlords.&lt;/p&gt;</description><link>http://lashomb.tumblr.com/post/32410304156</link><guid>http://lashomb.tumblr.com/post/32410304156</guid><pubDate>Thu, 27 Sep 2012 15:29:00 -0500</pubDate></item><item><title>Getting started with Puppet</title><description>&lt;p&gt;Gary Larizza and Chris Barker of Puppet Labs hosted a webinar today on a special use case of using Puppet, namely to manage Mac OS X workstations. I don&amp;#8217;t see it posted online yet, but check &lt;a href="http://puppetlabs.com/misc/webinars/" target="_blank"&gt;here&lt;/a&gt; for Puppet Labs to post the webinar later on.&lt;/p&gt;

&lt;p&gt;This post for now is going to assume you have a Puppet server up and running. If this is an obstacle, I&amp;#8217;d recommend downloading the &lt;a href="http://info.puppetlabs.com/download-learning-puppet-VM.html" target="_blank"&gt;Learning Puppet VM&lt;/a&gt;, which supports up to 10 nodes.&lt;/p&gt;

&lt;h2&gt;Installing and configuring the agent (client)&lt;/h2&gt;

&lt;p&gt;Every server and client needs puppet and facter installed. You can download the Mac packages &lt;a href="http://downloads.puppetlabs.com/mac/" target="_blank"&gt;here&lt;/a&gt;, and deploy them however you would install a package (Apple Remote Desktop, Munki, Casper, etc). I used &lt;strong&gt;facter-1.6.11.dmg&lt;/strong&gt; and &lt;strong&gt;puppet-2.7.19.dmg&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The glaring bug in the Mac package of puppet is that the puppet user and group are not created upon installation. Fortunately enough, a couple puppet one-liners easily remedy that.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo puppet resource user puppet ensure=present
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And again for the group.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo puppet resource group puppet ensure=present
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You&amp;#8217;ll see output like this showing that it&amp;#8217;s been created:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;notice: /Group[puppet]/ensure: created

group { 'puppet':

  ensure =&amp;gt; 'present',

}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we add the user puppet to the group puppet.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo dscl . append /Groups/puppet GroupMembership puppet
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I also want to hide this user from the login window. If you use a blank login prompt, you don&amp;#8217;t really need this.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add puppet
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now that we&amp;#8217;ve got that done, lets create our puppet.conf file. I like to use vim in Terminal, but you can use any editor you like. Create a file in /etc/puppet called puppet.conf. We want to define our server name in this file. I also like to define plugin sync, and if you have wonky DHCP/DNS issues as described &lt;a href="http://community.centrify.com/t5/The-Centrify-Apple-Guy/Updating-your-Mac-Hostname-in-DNS/ba-p/6060" target="_blank"&gt;here&lt;/a&gt;, you can even define certname. Here&amp;#8217;s what I started with.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[main]
pluginsync = true
server=master.puppet.domain
[agent]
certname=machost.domain
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After that&amp;#8217;s done, we need to set ownership of the /etc/puppet directory.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo chown -R puppet:puppet /etc/puppet
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Next, let&amp;#8217;s run puppet to generate the SSL cert request to the server. We&amp;#8217;ll get back to this later.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo puppet agent -t
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Config the node on the server&lt;/h2&gt;

&lt;p&gt;For this next section, I&amp;#8217;ll use Gary&amp;#8217;s module he introduced today, which includes a class for installing Firefox.&lt;/p&gt;

&lt;p&gt;From your Puppet server, you can install it with this command:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo puppet module install glarizza-osx_management&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;You can also download it from &lt;a href="http://forge.puppetlabs.com/glarizza/osx_management" target="_blank"&gt;Puppet Forge&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To keep things simple, I&amp;#8217;ll only use the &lt;code&gt;/etc/puppet/manifests/sites.pp&lt;/code&gt; file. It&amp;#8217;s more likely that you&amp;#8217;ll segment into other nested files, but for this example, we can start here.&lt;/p&gt;

&lt;p&gt;Inside this file, lets define a node. In this case I&amp;#8217;m defining this as default, but for a specific node, you would replace default with the name of the node (either DNS or defined as certname in puppet.conf) wrapped in single quotes (&amp;#8216;nodename&amp;#8217;).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;node default {
include osx_management::firefox
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This shows that I&amp;#8217;m including the manifest firefox, included within the osx_management module we just installed. Let&amp;#8217;s look at this manifest which is installed in /etc/puppet/modules/osx_deployment/.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;class osx_management::firefox {
  $package_name = 'Firefox%2015.0.dmg'

  package { $package_name:
    ensure   =&amp;gt; present,
    provider =&amp;gt; appdmg,
source =&amp;gt; "http://download-origin.cdn.mozilla.net/pub/mozilla.org/firefox/releases/15.0/mac/en-US/Firefox%2015.0.dmg",
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I modified this from the original, which includes version 14 of Firefox, but it does the same thing. It will pull down the .dmg file using curl, it will use the provider appdmg to tell it to copy the .app file to the /Applications directory.&lt;/p&gt;

&lt;p&gt;Last, we need to sign the certificate from our node. You can list the certs waiting to be signed with this command.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;puppet cert list&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now sign the cert.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;puppet sign certname&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Back to the client&lt;/h2&gt;

&lt;p&gt;Now lets go back to our client and see if this all works. Let&amp;#8217;s run the same command again. This time we have the SSL cert signed, so it will actually do something.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo puppet agent -t&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now we see puppet do it&amp;#8217;s thing. Lots of lines referencing .rb files rush past in Terminal and we eventually get to the catalog run at the end. You should see at the end of it all a notice line:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;notice: /Stage[main]/Osx_management::Firefox/Package[Firefox.dmg]/ensure: created&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Success!&lt;/p&gt;</description><link>http://lashomb.tumblr.com/post/30438782998</link><guid>http://lashomb.tumblr.com/post/30438782998</guid><pubDate>Wed, 29 Aug 2012 00:13:00 -0500</pubDate></item><item><title>Universal Type Server not accepting any logins</title><description>&lt;p&gt;We had a server crash, and went it came back up, Universal Type Server 2.1 wouldn’t accept any user logins. When I went to the UTS Users &amp;amp; Groups administration (port 8080) site, I couldn’t login with administrator. I know the password wasn’t changed.&lt;/p&gt;

&lt;p&gt;Sounds like something got corrupted. I tried reinstalling UTS, but it wanted all UTS processes to be shutdown first.&lt;/p&gt;

&lt;p&gt;First unload the launchd process:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo launchctl unload /Library/LaunchDaemons/com.extensis.server.web.admin.launchd.plist
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then stop the Java runtime:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo java -jar /Applications/Extensis/Universal\ Type\ Server/applications/jetty/stop.jar
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This one spit out errors on authentication, confirming the database is likely corrupt.&lt;/p&gt;

&lt;p&gt;Lastly, we shutdown JBoss:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo /Applications/Extensis/Universal\ Type\ Server/applications/jboss/bin/shutdown.sh -S
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now, following this &lt;a href="http://www.extensis.com/en/support/kb_article.jsp?articleNumber=8501222" target="_blank"&gt;Extensis KnowledgeBase article&lt;/a&gt;, I was able to reinstall UTS, get into the Administration Site (port 18081) and restore the database from backup.&lt;/p&gt;</description><link>http://lashomb.tumblr.com/post/6796078343</link><guid>http://lashomb.tumblr.com/post/6796078343</guid><pubDate>Wed, 22 Jun 2011 12:59:00 -0500</pubDate><category>universal type server</category><category>extensis</category></item><item><title>Reposado</title><description>&lt;p&gt;I&amp;#8217;ve replaced our Mac OS X Server&amp;#8217;s Software Update Server (SUS) with an open source alternative done by Walt Disney Animation Studios, or more specifically, Greg Neagle.&lt;/p&gt;
&lt;p&gt;The software is called &lt;a title="Reposado" href="http://managingosx.wordpress.com/2011/05/04/introducing-reposado/" target="_blank"&gt;Reposado&lt;/a&gt;, and it uses Python, curl and a web server (Apache in my case) to replicate Apple&amp;#8217;s SUS. It also offers furthur capability allowing you to create branches, allowing control over testing before releasing to all.&lt;/p&gt;
&lt;p&gt;The biggest benefit at least for me, is that it will run easily on Linux. Which means you can easily run it on a VM. I setup a Debian VM with the default web server selection, and only needed to add ssh, curl and the reposado software itself to get up and running. You&amp;#8217;ll want to kick off your initial repo_sync at night or on the weekend though, the full library of Apple&amp;#8217;s updates is ~44&amp;#160;GB.&lt;/p&gt;</description><link>http://lashomb.tumblr.com/post/6756920368</link><guid>http://lashomb.tumblr.com/post/6756920368</guid><pubDate>Tue, 21 Jun 2011 10:23:00 -0500</pubDate><category>SUS</category><category>Reposado</category></item></channel></rss>
