Hi,

As promised in an earlier message, here are some improvements on
the network device patch that has been included in 2.7.x.

Namely this patch brings:

* a fact system for remote device with a simple cisco implementation

* a new (legacy) application that acts as a proxy between
the device and a puppet master. This makes possible to write manifests
and use node/ENC definitions like we do for real POSIX hosts.

* a slight refactor in the network device system.

* resource isolation: when applying a catalog for a network device, only
"network device" enabled resource can be applied (the others are skipped).
The idea is that applying a network device catalog, we shouldn't modify
the underlying host on which puppet device is running.

A word about the puppet device application:

Puppet device gets its device list from the device.conf config file.
It then loop and ask/apply a catalog for each devices in a specific
$statedir. This way, the remote device are managed like any other
normal hosts, adding the benefits of several puppet features like
certificate security, or reports.

The format of the device.conf is simple:
[device.name]
type <type>
url <url>

Where <type> is the device type, currently cisco only.
And <url> is the same kind of device url introduced in the previous
patch.

The future:

For the moment, there is no "device config" indirection that would allow
to replace the current device.conf file by an ENC or any other system. 
I believe this is easy to add in a subsequent patch.

There are some refactorings that I plan to add regarding how the connections
to the remote device are managed and used, in a way to optimize the device
configuration. For the moment the system works as advertised but connects
multiple times to the device (to get the facts and then for every resources 
fetch/flush)
which can be slow.

The full code lives here, and all tests are green:
https://github.com/masterzen/puppet/tree/feature/puppet-device

Comments and review are welcome,
Brice

Brice Figureau (8):
  Cisco device facter system
  Add a network device facts terminus
  Add a NetworkDevice singleton
  Puppet device config file handling
  Puppet device application
  Network Device provider now uses the device singleton
  Better error message with ssh connection/authentication errors
  Add resource isolation to puppet device/agent

 lib/puppet/application/device.rb                   |  255 ++++++++++++++
 lib/puppet/defaults.rb                             |    5 +
 lib/puppet/indirector/facts/network_device.rb      |   25 ++
 lib/puppet/provider/cisco.rb                       |    9 +
 lib/puppet/provider/interface/cisco.rb             |   18 +-
 lib/puppet/provider/network_device.rb              |   21 +-
 lib/puppet/provider/vlan/cisco.rb                  |   14 +-
 lib/puppet/resource/catalog.rb                     |    1 +
 lib/puppet/transaction.rb                          |    4 +-
 lib/puppet/type.rb                                 |   28 ++
 lib/puppet/type/interface.rb                       |    2 +
 lib/puppet/type/schedule.rb                        |    2 +
 lib/puppet/type/vlan.rb                            |    2 +
 lib/puppet/util/command_line.rb                    |    3 +-
 lib/puppet/util/network_device.rb                  |   12 +-
 lib/puppet/util/network_device/base.rb             |   32 +-
 lib/puppet/util/network_device/cisco/device.rb     |   10 +
 lib/puppet/util/network_device/cisco/facts.rb      |   72 ++++
 lib/puppet/util/network_device/config.rb           |   93 ++++++
 lib/puppet/util/network_device/transport.rb        |    4 +-
 lib/puppet/util/network_device/transport/ssh.rb    |    4 +
 spec/integration/transaction_spec.rb               |   56 ++++
 spec/unit/application/device_spec.rb               |  349 ++++++++++++++++++++
 spec/unit/indirector/facts/network_device_spec.rb  |   89 +++++
 spec/unit/provider/cisco_spec.rb                   |   16 +
 spec/unit/provider/interface/cisco_spec.rb         |   20 +-
 spec/unit/provider/network_device_spec.rb          |   21 +-
 spec/unit/provider/vlan/cisco_spec.rb              |   20 +-
 spec/unit/resource/catalog_spec.rb                 |    1 +
 spec/unit/transaction_spec.rb                      |   18 +
 spec/unit/type/interface_spec.rb                   |    5 +
 spec/unit/type/schedule_spec.rb                    |    8 +
 spec/unit/type/vlan_spec.rb                        |    5 +
 spec/unit/util/network_device/cisco/device_spec.rb |  137 +-------
 spec/unit/util/network_device/cisco/facts_spec.rb  |   63 ++++
 spec/unit/util/network_device/config_spec.rb       |  102 ++++++
 .../unit/util/network_device/transport/ssh_spec.rb |    8 +
 spec/unit/util/network_device_spec.rb              |   45 +++
 38 files changed, 1369 insertions(+), 210 deletions(-)
 create mode 100644 lib/puppet/application/device.rb
 create mode 100644 lib/puppet/indirector/facts/network_device.rb
 create mode 100644 lib/puppet/provider/cisco.rb
 create mode 100644 lib/puppet/util/network_device/cisco/facts.rb
 create mode 100644 lib/puppet/util/network_device/config.rb
 create mode 100644 spec/unit/application/device_spec.rb
 create mode 100644 spec/unit/indirector/facts/network_device_spec.rb
 create mode 100644 spec/unit/provider/cisco_spec.rb
 create mode 100644 spec/unit/util/network_device/cisco/facts_spec.rb
 create mode 100644 spec/unit/util/network_device/config_spec.rb
 create mode 100644 spec/unit/util/network_device_spec.rb

-- 
1.7.2.1

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to