Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ positional arguments:
options:
-h, --help show this help message and exit
--debug, -d debug flag
--insecure disable TLS certificate verification for OpenStack API connections

Example of use:
openstack-helper --help
Expand Down
7 changes: 6 additions & 1 deletion src/openstack_helper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ def parse_args():
)

parser.add_argument("--debug", "-d", action="store_true", help="debug flag")
parser.add_argument(
"--insecure",
action="store_true",
help="disable TLS certificate verification for OpenStack API connections",
)

# Add subcommands options
subparsers = parser.add_subparsers(required=True, dest="command")
Expand Down Expand Up @@ -340,7 +345,7 @@ def main():

logging.debug(args)

openstack_api = OpenStackAPI()
openstack_api = OpenStackAPI(insecure=args.insecure)
try:
args.func(openstack_api, args)
except ValueError as e:
Expand Down
5 changes: 3 additions & 2 deletions src/openstack_helper/openstack_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ class OpenStackAPI:
placement (PlacementAPI): Interface to OpenStack Placement operations.
"""

def __init__(self, debug=False):
def __init__(self, debug=False, insecure=False):
"""
Initialize the OpenStackAPI instance and establish a connection.

Args:
debug (bool): Whether to enable debug logging.
insecure (bool): If True, disable TLS certificate verification
"""
openstack.enable_logging(debug=debug)
self.os_conn = openstack.connect()
self.os_conn = openstack.connect(insecure=insecure)

self.image = ImageAPI(self.os_conn)
self.compute = ComputeAPI(self.os_conn)
Expand Down