Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wheel #1571

Merged
merged 20 commits into from
Jun 10, 2024
Merged

Wheel #1571

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