Skip to content

Commit d7216bd

Browse files
authored
Merge pull request #130 from aruba/hostnames-system-info-patch
Hostnames system info patch
2 parents e661f8f + 188ab31 commit d7216bd

3 files changed

Lines changed: 18 additions & 9 deletions

File tree

‎rename-hostnames/README.md‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# Rename Hostnames
2-
This workflow uses the PyCentral SDK to automate configuring hostname profiles of
3-
devices in Central. The workflow first checks the device serial numbers against Central
4-
to verify devices are ready to be provisioned. Then, device hostname profiles are either
5-
created or updated determined by their current hostname status. The workflow will also
6-
create a CSV output file containing the status of hostname configuration operations.
2+
This workflow uses the PyCentral SDK to automate configuring the hostname of devices in
3+
Central. The workflow first checks the device serial numbers against Central to verify
4+
devices are ready to be configured. Then, device hostnames are either created or
5+
updated determined by their current System Information profile status. Only the default
6+
System Information profile will be updated. In the case where there are no current
7+
profiles, one will be created with the default profile name of "sys-system-info-profile"
8+
The workflow will also create a CSV output file containing the status of hostname
9+
configuration operations.
710

811
## Prerequisites
912
- Python 3.8 or higher
1013
- API credentials for HPE Aruba Networking Central(YAML format)
11-
- All target devices are ready for provisioning in Central
14+
- All target devices are provisioned and configuration ready
1215

1316
## Installation
1417

@@ -28,7 +31,7 @@ source venv/bin/activate # On Windows use: venv\Scripts\activate
2831
pip install -r requirements.txt
2932
```
3033

31-
_This workflow is tested on the PyCentral SDK (version: 2.0a16). Please check compatibility before executing on older/newer versions as there may be changes_
34+
_This workflow is tested on the PyCentral SDK (version: 2.0a21). Please check compatibility before executing on older/newer versions as there may be changes_
3235

3336
## Configuration
3437

‎rename-hostnames/rename_hostnames.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
new_hostnames = []
1515
device_functions = []
1616
status = []
17-
sys_info_path = generate_url("system-info")
17+
sys_info_path = generate_url("system-info/sys-system-info-profile")
1818

1919

2020
def define_arguments():
@@ -152,6 +152,12 @@ def checking_devices(scope, serial_number):
152152
f" {colored('Error', 'red')}: Device {colored(serial_number, 'blue')} not provisioned in Central.\n"
153153
)
154154
status.append("failure")
155+
elif not device_function:
156+
spinner.fail()
157+
print(
158+
f" {colored('Error', 'red')}: Device {colored(serial_number, 'blue')} has no persona assigned.\n"
159+
)
160+
status.append("failure")
155161
else:
156162
spinner.succeed()
157163
print(

‎rename-hostnames/requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
halo==0.0.31
2-
pycentral==2.0a16
2+
pycentral==2.0a21

0 commit comments

Comments
 (0)