|
Revision 15, 487 bytes
(checked in by daedalus, 5 years ago)
|
|
Updated to generic command based processing.
Attempting to implement some form of include based processing
to add modularity.
|
| Line | |
|---|
| 1 | """ |
|---|
| 2 | A generic Device definition to use for change targets. |
|---|
| 3 | """ |
|---|
| 4 | |
|---|
| 5 | class Device: |
|---|
| 6 | |
|---|
| 7 | def __init__(self, name): |
|---|
| 8 | self.name = name |
|---|
| 9 | self.fqdn = None |
|---|
| 10 | self.ipaddress = None |
|---|
| 11 | self.namespace = {} |
|---|
| 12 | |
|---|
| 13 | def __str__(self): |
|---|
| 14 | """ |
|---|
| 15 | Return the most precise definition for the device |
|---|
| 16 | """ |
|---|
| 17 | if self.ipaddress: |
|---|
| 18 | return '%s' % self.ipaddress |
|---|
| 19 | elif self.fqdn: |
|---|
| 20 | return self.fqdn |
|---|
| 21 | else: |
|---|
| 22 | return self.name |
|---|