Skip to content

Commit dd61eaa

Browse files
committed
Merge branch 'release-v5.8.18'
2 parents e6c5e33 + 5ca1edf commit dd61eaa

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

README.md

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# NetFoundry Python Module
2+
3+
This module has a general-purpose library for using the NetFoundry API and installs the CLI `nfctl`.
14

25
## User Guide
36

@@ -6,18 +9,19 @@
69
## Find the Version
710

811
```bash
9-
$ python3 -m netfoundry.version
12+
$ python3 -m netfoundry.version
13+
v5.2.0
14+
# or
15+
$ nfctl version
1016
v5.2.0
1117
```
1218

1319
## Play the demo
1420

15-
This creates a demo network named "BibbidiBobbidiBoo" with your API account stored in ~/.netfoundry/credentials.json
16-
17-
Learn about getting an API account by reading the [Authentication Guide](https://developer.netfoundry.io/v2/guides/authentication/)
21+
This creates a demo network with your API account file named `credentials.json` stored in the current directory or the XDG config directory e.g. `~/.config/netfoundry/`. Learn how to obtain and use an API account for your NetFoundry organization in [the Authentication Guide](https://developer.netfoundry.io/guides/authentication/)
1822

1923
```bash
20-
python3 -m netfoundry.demo --network=BibbidiBobbidiBoo
24+
nfctl demo
2125
```
2226

2327
## Create network snippet from demo.py
@@ -29,19 +33,19 @@ import netfoundry
2933
# user-default path is ~/.netfoundry/
3034
organization = netfoundry.Organization(credentials="credentials.json")
3135

32-
# use some Network Group, default is to use the first and there's typically only one
36+
# use some network group, default is to use the first and there's typically only one
3337
network_group = netfoundry.NetworkGroup(organization)
3438

35-
# create a Network
39+
# create a network
3640
network_name = "BibbidiBobbidiBoo"
37-
if network_name in network_group.networks_by_name().keys():
38-
# use the Network
41+
if network_group.network_exists(network_name):
42+
# use the network
3943
network = netfoundry.Network(network_group, network_name=network_name)
40-
network.wait_for_status("PROVISIONED",wait=999,progress=True)
44+
network.wait_for_status("PROVISIONED")
4145
else:
4246
network_id = network_group.create_network(name=network_name)['id']
4347
network = netfoundry.Network(network_group, network_id=network_id)
44-
network.wait_for_status("PROVISIONED",wait=999,progress=True)
48+
network.wait_for_status("PROVISIONED")
4549
```
4650

4751
## Publish a new version of the module
@@ -65,4 +69,4 @@ else:
6569
12:00 Verify Published Artifacts in PyPi and Hub
6670
12:30 PyPi Upgrade Gets New Version
6771
13:30 Docker Run Check Version
68-
```
72+
```

netfoundry/ctl.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ def use_network_group(cli, organization: object, group: str = None, spinner: obj
11741174
with spinner:
11751175
network_group = NetworkGroup(
11761176
organization,
1177-
group=group if group else None,
1177+
group=group,
11781178
)
11791179
spinner.succeed(f"Configured network group '{network_group.name}'")
11801180
cli.log.debug(f"network group is {network_group.name}")

netfoundry/utility.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,13 @@ def find_generic_resources(url: str, headers: dict, embedded: str = None, proxie
393393
yield yield_page
394394

395395
# then yield subsequent pages, if applicable
396-
if get_all_pages: # this is False if param 'page' or 'size' to stop recursion or get a single page
397-
for next_page in range(1, total_pages): # first page is 0
396+
if get_all_pages: # this is False if param 'page' or 'size' to stop recursion or get a single page
397+
if resource_type.name == 'network-groups':
398+
params['page'] = 1 # workaround API bug https://netfoundry.atlassian.net/browse/MOP-17890
399+
next_range_lower, next_range_upper = params['page'] + 2, total_pages + 1
400+
else:
401+
next_range_lower, next_range_upper = params['page'] + 1, total_pages
402+
for next_page in range(next_range_lower, next_range_upper): # first page is 0 unless network-groups which are 1-based
398403
params['page'] = next_page
399404
try:
400405
# recurse

0 commit comments

Comments
 (0)