Testing import of CSV imports in Ruby on Rails

It’s been a few weeks since I did any work on Rails-CMDB. This is mainly down me being busy and getting stuck on how to test the import of data. I’ve come to the conclusion that it really is an integration story, so now the problem is how to do the file uploads.

It’ll not be hard to generate a complete set of CSV files and place them on disk, but my issue would be how to upload them. Does anyone have any useful suggestions ?

Correct system time is a security issue

There’s a story that hit Slashdot today about Debian (see bug #433869) not using the security.debian.org system to send out an update to the timezone data for a change in New Zealand daylight savings time.

The update in question is not a security fix, however having the correct time on a system is very important for security. Without the correct local time across all of your different systems (and thus having the correct timestamp on log messages) you will not be able to collate messages between different systems (e.g. routers, firewalls, other unix/linux systems) during an incident. This has already been released by Microsoft, Red Hat and, I expect, other vendors.

To me this seems just to be another reason that an commercial company should not run Debian GNU/Linux as you’re at the whims of a bunch of volunteers who are unlikely to understand the security concerns of your business (e.g. PCI/DSS or Sarbanes-Oxley). However it’s still a good OS if you’re running a personal system or if you can have a team of Debian sysadmins/developers at your call to backport important package changes.

Rails-CMDB release 0.4

It’s taken a long time to get this release of Rails-CMDB ready for release, as I’ve done some tidying of the code base, plus adding lots of unit and functional tests. I’ve also improved the the views into the database and added the notation of Environments within Locations.

The source code can be found here. Not sure what is going to be in the next version, however I would like to get a public Subversion repository set up when I feel the testing good enough to catch any issues.

See below the cut for the (incomplete) change logs for version 0.4 (and the unreleased 0.3).

Continue reading

Testing Love and Ruby on Rails

For the last couple of weeks in some of my spare time I’ve being writing unit and functional tests for Rails-CMDB. So far it’s helped me spot a more than a few issues, the most surprising to me was the naming of my os controller, which the functional test tried to test as O. So currently I’m in the process of refactoring things to mesh better with the Rails idiom.

The main upshot of all of this; it’s likely to be early October before the next release of Rails-CMDB, and the version number is very likely to jump a few points due to unreleased versions.

I’m also contemplating what new features the next released version will have and so far I’m thinking of the following:

  • Environments: Separating out different types of devices within the same location (e.g. test, stage and production).
  • Virtual Machines: Modeling devices that are virtual and running as a guest on physical device.

The Ruby on Rails way for Model naming

Following the comment from Graeme Mathieson on my last post on Rails-CMDB about the the Rails way for naming of columns within Models. I’m planning on doing the following column rename for the next release of Rails-CMDB:

rename_column :assets, :delivery_date, :delivered_on
rename_column :assets, :removal_date, :removed_on

rename_column :locations, :start_date, :started_on
rename_column :locations, :end_date, :ended_on

rename_column :purchase_orders, :o rder_date, :o rdered_on

rename_column :vendors, :last_order_date, :stopped_ordering_on

So the question for the Rails coders out there – does this seem correct ? There’s also a single table who’s primary field is not called name, so I guess to do it in the Rails way it should be changed as well.

I’ve also created about 90 unit test stubs and now just comes the hard part of coding the tests ;-)

Rails-CMDB release 0.2

Well it’s been a month since the first release of Rails-CMDB and it’s now time for another release. This is the rather large list of changes:

  • Added some unit tests for PurchaseOrder.
  • Added Export to CSV.
  • Added Import from CSV.
  • An asset can have many hardware items.
  • The Asset name does not need to be a number.
  • Catch trying to show a device that does not exist.
  • Add order_date column to PurchaseOrder Model.
  • Rename order_date column in Asset to delivery_date.
  • Correct typo’s in CreateNetworks which prevented loading of the schema.
  • Rename the database’s used to match the application name.
  • Added some simple doc’s on getting the system up and running.
  • Change to using host: 127.0.0.1 in database.yml instead of sockets.

The source code can be found here. Not sure what is going to be in the next version, however I expect it’ll not be ready for release until mid to late September.

First release of Rails-CMDB (v0.1)

This is the first ever release (0.1) of Rails-CMDB, the Ruby on Rails project I’ve been working on since the end of last month. It’s best described as little rough round the edges and the under laying DB schema may change with no upgrade path. However it’s possible to enter (and change) all of information via the interface and also view all details for a device on a single page.

The source code can be found here on my main web site, I’ll try to do a second release within the next few weeks when I get an idea of what’s needed next (I’m currently thinking it’ll need to be import or export via an Excel speed sheet or a CSV file).

Update: It’s been pointed out the me that I did not say what this software is, you can find a lot more details ITIL defines as a configuration management database (cmdb) in this post from last month.

The on going experance with Ruby on Rails

The experimental Ruby on Rails application is plodding along nicely, so far I have about six database tables with relationships between a number of them, and I’m getting it to display meaningful data from them.

I’m slowly starting to get my head round how to set up table relationships. Over the weekend I expect to have the first pass at a workable data model that records most of the required database. This is going slowly as I’m only getting to spend about an hour a day on this project.

It’s likely that I may be in a position to publish some working code late in July (or early August).

Ruby on Rails (take 2)

Since Saturday I’ve carried on looking at Ruby on Rails and so far I’m very impressed. While reading though the first part about of Agile Web Development with Rails, I wrote a simple web application which displays some data from a single database table, requires a logged in session to change data and always has user management via the admin interface. I don’t think I could have gotten this much done in so little time (and code) in any other language.My next target to get a better understanding of the data model system and set up some inter-table relationship. In about a month or so the application may very well worth publishing.

Ruby on Rails

Last night I went to ScotRUG mainly to meet mathie, but also to find out what all the fuss is about and so far I like what I’ve heard. It being like Python (without the whitespace) is a good thing as Python has been my programming language of choice for many years.

While thinking about starting this blog I was looking at PHP, trying to get my head round it as a programing language (which is a title I don’t think it really deserves). From the few hours that I spent tying to code a simple application, the vile and loathing for PHP has come back in force.

So today I’m going to try and find my first Ruby on Rails book as I generally want to learn more about Agile Development methods and Rudy on Rails. There’s that itch forming to write something while learning Ruby on Rails, which should be interesting as I’ve never written a web application before. Also my new book on CSS can be put to good use.

Update: I’ve now got 2 Ruby on Rails books, read the first few chapters of Agile Web Development with Rails and so far it sounds like a very nice framework, next is getting an environment set up and the staple hello world!