DSS class interface

I have been mucking around with getting information in and out of Deploy Studio Server(DSS). DSS uses a web service which, apart from the web page itself, doesn’t appear to be documented anywhere.
After trial and error (using wireshark and my hex editor 0xED) I have managed to get a DSS php class together.
It’s function is currently limited to:

  • Add Computer
  • Delete Computer
  • Add Group
  • Add Multiple Computers
  • Delete Group
  • Get all Groups

Using this class in combination with a bit of dscl scripting, it is possible to ‘mirror’ the group membership of Workgroup Manager (WGM) on OS X server with DSS. It does not currently ‘sync’ the group membership info, but it may well do that already, I have just not tested it yet.
I have modified the script now to sync the groups and computers. It works as follows:
1. Generate list of groups in workgroup manager
2. Generate list of groups in Deploy Studio
3. From above 2 lists, generate 2 other lists => list of groups in WGM and not in DSS, list of groups in DSS and not in WGM
4. Add groups into DSS that are in WGM and not in DSS.
5. Delete groups in DSS that are in DSS and not in WGM.
6. Generate list of computers in WGM
7. Generate list of computers in DSS
8. From above 2 lists, generate 1 other list => list of computers in DSS not in WGM
9. Add all computers to DSS from list generated in step 6
10. Delete computers from DSS from list generate in step 8.

This method means that if you moved computers (into different groups) this changed would be updated in DSS. It also means that if you apply and workflows at the computer level (and not the group level) the changes will be lost on the next sync.

This new version deprecates the use of the xml class files and xml templates, instead it uses the CFPropertyList class from google code. This class however, needs to be modified to allow the loading of a plist string (My feature request). The changes required to this class are documented there, if you have any questions about this modification, please ask me.

Please feel free to enhance the DSS classes’ functions, but if you do please let me know so that it may be added to this class for all to make use of.

Documentation
Please see here for my class documentation

Requirements:

  • PHP >=5.2.6 (that’s what my test system is on.. – 10.5.8 server) It will probably work on 5.0 and above
  • class.curl.php from http://munroe.users.phpclasses.org/browse/package/1988.html
  • CFPropertyList-1.0.4 from HereNote this needs to be modified to allow strings to be loaded, see This post for details.
  • If you want to get groups from WGM to DSS then you need command line access to the WGM server
  • A little bit of php programming knowledge, while I’m sure my code is working, it is not foolproof. Please use this code with care as I will not accept any liability or responsibility for any data loss or damage caused as a result of running this code in your environment

Files in the zip package

  1. The DSS class (class.dss_int.php)
  2. A script (wgmsyncdss.php) which will import group and computer information from WGM to DSS. This script must be run on a machine that is bound to your OD and also has network access to the DSS server. there are some fields you will need to set – DSS_URL, DSS_adminuser, DSS_adminpass. You may also want to filter the WGM computer list – ie if you have a ‘server’ group you probably don’t want this added to DSS.

Download DSS_class_files_0.3

Avrdude command line

The command line format is:

avrdude -p {partnumber} <options>

To see the list of part numbers, run avrdude -p ?

Options that I will use programming AVRs are:

-c <programmer>            Specify programmer type.

-P <port>                  Specify connection port.

The typical command line will be : avrdude -p attiny2313 -c stk500v2 -P /dev/cu.usbserial-id.
* todo – plug in new usb to serial dongle when it arrives, ls /dev/cu.* and find out what I should replace usbserial-id with above..

LCD across ports

Using CodevisionAVR in the past, it has been great to use the LCD library to interface with an LCD. When this is not so great is if you have a non-standard setup and wish to connect the LCD to the AVR across different ports. I have this issue with my next project – a LCD interface for other microcontrollers. I am going to use the Tiny2313 and it can accept commands via either serial or i2c interface. The interface will be selected by 2 input lines (configured by jumpers). These 2 input lines will also configure the serial communication speed if it is used. The one issue I have come across so far is that the USI pins and serial pins are on separate ports and will need to be available. This does not leave a full port for the LCD interface, requiring the LCD data lines (4 pins) and the control lines (3 pins) will have to span ports. The upshot of this is that I cannot use the built in LCD library in CodevisionAVR. This is what has lead me down the path of programming the AVR on my OS X machine.

The google gods have guided me to this site http://winavr.scienceprog.com/example-avr-projects/avr-4-bit-lcd-interface-library.html which is pretty much exactly what I’m looking for.

Xcode and AVR development

First I have to note that apart from creating the “Hello World” application in Xcode, I have not used Xcode for any application development. Most of my avr code development has been fairly dodgy C code using CodevisionAVR (and assembly code when I was first introduced to microcontroller programming)

So I decided to try and do all my AVR development on my mac. First thing to do was download and install CrossPack from http://www.obdev.at/products/crosspack/index.html. These folks have done a stella job of packaging pretty much all the required software.

The first place I went to to get the OS X avr development tools was http://www.digithink.com/OSX-AVR/ but he pointed users to the CrossPack instead of his package. He did make note however that he was going to contact them and ask them to include the Xcode templates.

I had a look at the Xcode template that is supplied with OSX-AVR (created by Nick Lott) and it looked ok. Installing just the Xcode templates however, put them in the wrong place for my system   (I’m running Xcode 3.1.2 and OS X.5.6). They were installed into /Library/Application Support/Apple/Developer Tools. I moved them to ~/Library/Application Support/Developer/Shared/Xcode/

I created a new project using the Basic AVR C project and Built it. The build failed because it was trying to find avr-gcc and it was not in the Xcode project template path. So I edited the project.pbxproj file in ~/Library/Application Support/Developer/Shared/Xcode/Project Templates/AVR/Basic AVR C Project/AVR.xcodeproj directory and removed PATH = “/sw/bin/:/usr/local/bin/:$PATH”; and replaced it with PATH = “$(PATH):/usr/local/CrossPack-AVR/bin”; I had to replace about three instances of this path. After making these changes I was able to successfully build the sample code provided with the template.

Record of type dsRecTypeStandard:Config named: ‘ServicesInformationXXXX’ already exists

So I went to my development OS X.5.6 server yesterday and it was taking forever to do anything, with nothing but the spinning beach ball happening.

Looking at the logs, it seemed that servermgrd was having issues (also noted that DirectoryService was running at 100% cpu) trying to create/edit a OD record in the local node.

The following error appeared in the log:

Apr 17 09:20:21 tur-macdev1 Python[47]: Record of type dsRecTypeStandard:Config named ‘ServicesInformation’ already exists in /Local/Default. Trying with new name: ServicesInformation1

Apr 17 09:20:21 tur-macdev1 Python[47]: Record of type dsRecTypeStandard:Config named ‘ServicesInformation1’ already exists in /Local/Default. Trying with new name: ServicesInformation2

Apr 17 09:20:21 tur-macdev1 Python[47]: Record of type dsRecTypeStandard:Config named ‘ServicesInformation2’ already exists in /Local/Default. Trying with new name: ServicesInformation3

Apr 17 09:20:21 tur-macdev1 Python[47]: Record of type dsRecTypeStandard:Config named ‘ServicesInformation3’ already exists in /Local/Default. Trying with new name: ServicesInformation4

Apr 17 09:20:21 tur-macdev1 Python[47]: Record of type dsRecTypeStandard:Config named ‘ServicesInformation4’ already exists in /Local/Default. Trying with new name: ServicesInformation5

Apr 17 09:20:21 tur-macdev1 Python[47]: Record of type dsRecTypeStandard:Config named ‘ServicesInformation5’ already exists in /Local/Default. Trying with new name: ServicesInformation6

Apr 17 09:20:21 tur-macdev1 Python[47]: Record of type dsRecTypeStandard:Config named ‘ServicesInformation6’ already exists in /Local/Default. Trying with new name: ServicesInformation7

Apr 17 09:20:21 tur-macdev1 Python[47]: Record of type dsRecTypeStandard:Config named ‘ServicesInformation7’ already exists in /Local/Default. Trying with new name: ServicesInformation8

Apr 17 09:20:21 tur-macdev1 Python[47]: Record of type dsRecTypeStandard:Config named ‘ServicesInformation8’ already exists in /Local/Default. Trying with new name: ServicesInformation9

Apr 17 09:20:21 tur-macdev1 Python[47]: Record of type dsRecTypeStandard:Config named ‘ServicesInformation9’ already exists in /Local/Default. Trying with new name: ServicesInformation10

Apr 17 09:20:22 tur-macdev1 servermgrd[53]: Record of type dsRecTypeStandard:Config named ‘ServicesInformation’ already exists in /Local/Default. Trying with new name: ServicesInformation1

And this went on for quite some time, creating several thousand extra records in the local directory.
After checking the contents of the /var/db/dslocal/nodes/Default/config directory, it would seems that /var/db/dslocal/nodes/Default/config/ServicesInformation.plist was for some reason empty.
To fix this error, I deleted all but one of the newly created ServicesInformationXXX.plist files, renamed it to ServicesInformation.plist and restarted the server. This seemed to do the trick and now the server runs ok.
As a side note, this record seems to have something to do with web services – blog, wiki etc. As stopping this services initially stopped the system trying to create this file.