nanliu/puppetlabs-razor — pull request #2 by jamezpolley (2012-10-02 02:40:52+00:00)
Title: Explicitly name the parameters passed to razor image add

Using this does not result in OS images being installed.

```
Debug: Prefetching default resources for rz_image
Debug: Executing '/usr/local/bin/razor image get'
Debug: "Images\n< none >\n"
Debug: Failed to gather results from command 'razor image get'.
Debug: razor image add os /tmp/images/ubuntu-12.04.1-server-amd64.iso precise_image 12.04
Debug: Executing '/usr/local/bin/razor image add os /tmp/images/ubuntu-12.04.1-server-amd64.iso precise_image 12.04'
/Stage[main]//Rz_image[precise_image]/ensure: created
Debug: /Stage[main]//Rz_image[precise_image]: The container Class[Main] will propagate my refresh event
Debug: Prefetching default resources for rz_model
Debug: Executing '/usr/local/bin/razor -w model get default'
Debug: Executing '/usr/local/bin/razor image get'
Debug: "Images\n< none >\n"
Debug: Failed to gather results from command 'razor image get'.
Debug: undefined method `[]' for nil:NilClass
Error: Failed to find image uuid for name precise_image.
Error: /Stage[main]//Rz_model[precise_model]/ensure: change from absent to present failed: Failed to find image uuid for name precise_image.
Debug: Prefetching default resources for rz_policy
Debug: Executing '/usr/local/bin/razor -w policy get default'
/Stage[main]//Rz_policy[precise_policy]: Dependency Rz_model[precise_model] has failures: true
Warning: /Stage[main]//Rz_policy[precise_policy]: Skipping because of failed dependencies
Debug: Prefetching apt resources for package
```

This seems to be because razor requires the parameters to be explicitly named:

```
root@puppetmaster:/tmp/razor-puppet-puppetdb# razor image
Images
< none >
root@puppetmaster:/tmp/razor-puppet-puppetdb# /usr/local/bin/razor image add os /tmp/images/ubuntu-12.04.1-server-amd64.iso precise_image 12.04
[Image] [add_image] <-Must Provide: [The type of image (mk, os, or esxi)]

Command help:
razor image add (options...)
-t, --type TYPE The type of image (mk, os, or esxi)
-p, --path /path/to/iso The local path to the image ISO
-n, --name IMAGE_NAME The logical name to use (os images only)
-v, --version VERSION The version to use (os images only)
-h, --help Display this screen.
```

Applying with this modification succeeds.

```
root@puppetmaster:/tmp/razor-puppet-puppetdb# puppet apply --modulepath modules manifests/init.pp Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
Warning: Found multiple default providers for vcsrepo: hg, cvs, svn, bzr, git; using hg
/Stage[main]//Rz_image[precise_image]/ensure: created
/Stage[main]//Rz_model[precise_model]/ensure: created
/Stage[main]//Rz_policy[precise_policy]/ensure: created
/Stage[main]/Razor/Rz_image[rz_mk_prod-image.0.9.0.4.iso]/ensure: created
/Stage[main]/Dhcp/Service[isc-dhcp-server]/ensure: ensure changed 'stopped' to 'running'
Finished catalog run in 35.34 seconds

root@puppetmaster:/tmp/razor-puppet-puppetdb# razor image
Images
UUID => 7ZV8FTbOWDU0cvc2N1vXoI
Type => MicroKernel Image
ISO Filename => rz_mk_prod-image.0.9.0.4.iso
Path => /opt/razor/image/mk/7ZV8FTbOWDU0cvc2N1vXoI
Status => Valid
Version => 0.9.0.4
Built Time => Tue Jul 03 22:49:49 +0000 2012

UUID => 70Lk01tqd2vec65Dd6KvCk
Type => OS Install
ISO Filename => ubuntu-12.04.1-server-amd64.iso
Path => /opt/razor/image/os/70Lk01tqd2vec65Dd6KvCk
Status => Valid
OS Name => precise_image
OS Version => 12.04

```