commit aa73290eb2d5ce8a185ced6ee711675d53f74aed Author: Cory Hawkvelt Date: Mon Nov 7 09:23:32 2022 +1030 First set of working module structure diff --git a/main.py b/main.py new file mode 100644 index 0000000..a5a8028 --- /dev/null +++ b/main.py @@ -0,0 +1,13 @@ +import os, sys +sys.path.append(os.path.join(os.path.dirname(__file__), "lib")) + +import myOpenstackApp + + +y=myOpenstackApp.OSC +y.initalise() +# y.ks.getCatalog() +y.something() +# print(y._keystone) + +print("Starting") \ No newline at end of file diff --git a/myOpenstackApp/OpenStackConnection.py b/myOpenstackApp/OpenStackConnection.py new file mode 100644 index 0000000..1328b22 --- /dev/null +++ b/myOpenstackApp/OpenStackConnection.py @@ -0,0 +1,27 @@ +class OpenStackConnection_x: + someProp=0 + ks=False + nova=False + + catalogData="" + novaURL="" + + """ + It's important not to initalise any of the submodules during the init cycle becuase thic causes cirtucalr import loops + The initalise function exists for this reas and should be caled by the client application using this module + """ + def __init__(self) -> None: + pass + + def initalise(self) -> None: + from myOpenstackApp.keystone import myopenstack_keystone + from myOpenstackApp.nova import myopenstack_nova + + self.ks=myopenstack_keystone(self) + self.nova=myopenstack_nova(self) + pass + + def something(_self): + print(1) + _self.ks.getCatalog() + _self.nova.showNovaURL() diff --git a/myOpenstackApp/__init__.py b/myOpenstackApp/__init__.py new file mode 100644 index 0000000..b590813 --- /dev/null +++ b/myOpenstackApp/__init__.py @@ -0,0 +1,3 @@ +from myOpenstackApp import OpenStackConnection + +OSC=OpenStackConnection.OpenStackConnection_x() diff --git a/myOpenstackApp/__pycache__/OpenStackConnection.cpython-310.pyc b/myOpenstackApp/__pycache__/OpenStackConnection.cpython-310.pyc new file mode 100644 index 0000000..a8de70f Binary files /dev/null and b/myOpenstackApp/__pycache__/OpenStackConnection.cpython-310.pyc differ diff --git a/myOpenstackApp/__pycache__/__init__.cpython-310.pyc b/myOpenstackApp/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..fea3a0e Binary files /dev/null and b/myOpenstackApp/__pycache__/__init__.cpython-310.pyc differ diff --git a/myOpenstackApp/__pycache__/keystone.cpython-310.pyc b/myOpenstackApp/__pycache__/keystone.cpython-310.pyc new file mode 100644 index 0000000..6400607 Binary files /dev/null and b/myOpenstackApp/__pycache__/keystone.cpython-310.pyc differ diff --git a/myOpenstackApp/__pycache__/nova.cpython-310.pyc b/myOpenstackApp/__pycache__/nova.cpython-310.pyc new file mode 100644 index 0000000..949e6ad Binary files /dev/null and b/myOpenstackApp/__pycache__/nova.cpython-310.pyc differ diff --git a/myOpenstackApp/keystone.py b/myOpenstackApp/keystone.py new file mode 100644 index 0000000..db54fcf --- /dev/null +++ b/myOpenstackApp/keystone.py @@ -0,0 +1,16 @@ +import myOpenstackApp.OpenStackConnection + + +class myopenstack_keystone(): + + def __init__(self,conn ) -> None: + self.conn=conn + + def echo(_self): + print("Helllooo") + + + def getCatalog(_self): + catalog="Some shit, more shit" + _self.conn.catalogData=catalog + _self.conn.novaURL="http://nova" diff --git a/myOpenstackApp/nova.py b/myOpenstackApp/nova.py new file mode 100644 index 0000000..aa52a81 --- /dev/null +++ b/myOpenstackApp/nova.py @@ -0,0 +1,17 @@ +import myOpenstackApp.OpenStackConnection + + +class myopenstack_nova(): + + def __init__(self,conn: myOpenstackApp.OpenStackConnection.OpenStackConnection_x ) -> None: + self.conn=conn + + def addNewVM(_self,Name, flavor): + return(Name) + + def getKeystone(_self): + _self.myOpenstackObject.keystone.echo() + + def showNovaURL(_self): + print(_self.conn.novaURL) + _self.conn