Skip to content

Commit

Permalink
Merge pull request #1571 from grycap/wheel
Browse files Browse the repository at this point in the history
Wheel
  • Loading branch information
micafer authored Jun 10, 2024
2 parents 778bfb9 + 3ec1a9f commit 3a23a05
Show file tree
Hide file tree
Showing 17 changed files with 1,810 additions and 441 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'

- name: Install dependencies
run: python -m pip install tox
Expand Down
11 changes: 11 additions & 0 deletions IM/REST.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import json
import base64
import flask
import os
import yaml

from cheroot.wsgi import Server as WSGIServer, PathInfoDispatcher
from cheroot.ssl.builtin import BuiltinSSLAdapter
Expand Down Expand Up @@ -939,6 +941,15 @@ def RESTGetVersion():
return return_error(400, "Error getting IM version: %s" % get_ex_error(ex))


@app.route('/')
def RESTIndex():
rest_path = os.path.dirname(os.path.abspath(__file__))
abs_file_path = os.path.join(rest_path, 'swagger_api.yaml')
api_docs = yaml.safe_load(open(abs_file_path, 'r'))
api_docs['servers'][0]['url'] = flask.request.url_root
return flask.make_response(json.dumps(api_docs), 200, {'Content-Type': 'application/json'})


@app.route('/infrastructures/<infid>/vms/<vmid>/disks/<disknum>/snapshot', methods=['PUT'])
def RESTCreateDiskSnapshot(infid=None, vmid=None, disknum=None):
try:
Expand Down
2 changes: 1 addition & 1 deletion IM/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Config:
LOG_FILE = '/var/log/im/inf.log'
LOG_FILE_MAX_SIZE = 10485760
LOG_LEVEL = "INFO"
CONTEXTUALIZATION_DIR = '/usr/share/im/contextualization'
CONTEXTUALIZATION_DIR = IM_PATH + '/../contextualization'
RECIPES_DIR = CONTEXTUALIZATION_DIR + '/AnsibleRecipes'
RECIPES_DB_FILE = CONTEXTUALIZATION_DIR + '/recipes_ansible.db'
MAX_CONTEXTUALIZATION_TIME = 7200
Expand Down
9 changes: 5 additions & 4 deletions im_service.py → IM/im_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
from IM.ServiceRequests import IMBaseRequest
from IM import __version__ as version

if sys.version_info <= (2, 6):
print("Must use python 2.6 or greater")
sys.exit(1)

logger = logging.getLogger('InfrastructureManager')

Expand Down Expand Up @@ -420,7 +417,7 @@ def signal_int_handler(signal, frame):
im_stop()


if __name__ == "__main__":
def main():
parser = argparse.ArgumentParser(description='IM service')
parser.add_argument('--version', help='Show IM service version.', dest="version",
action="store_true", default=False)
Expand All @@ -436,3 +433,7 @@ def signal_int_handler(signal, frame):

config_logging()
launch_daemon()


if __name__ == "__main__":
main()
Loading

0 comments on commit 3a23a05

Please sign in to comment.