First set of working module structure

This commit is contained in:
Cory Hawkvelt 2022-11-07 09:23:32 +10:30
commit aa73290eb2
9 changed files with 76 additions and 0 deletions

13
main.py Normal file
View File

@ -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")

View File

@ -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()

View File

@ -0,0 +1,3 @@
from myOpenstackApp import OpenStackConnection
OSC=OpenStackConnection.OpenStackConnection_x()

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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"

17
myOpenstackApp/nova.py Normal file
View File

@ -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