arpadboda commented on a change in pull request #527: MINIFICPP-672 - Bootstrap agent through Python URL: https://github.com/apache/nifi-minifi-cpp/pull/527#discussion_r269651866
########## File path: bootstrap.py ########## @@ -0,0 +1,298 @@ +#!/usr/bin/python +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +MINIFI_SUBFOLDER = '/nifi/nifi-minifi-cpp/' +APACHE_CLOSER_REPO_JSON_URL = 'https://www.apache.org/dyn/closer.cgi?as_json=1' +APACHE_MIRROR_LIST = "http://www.apache.org/mirrors/" + +import argparse +import sys + +if sys.version_info[0] < 3: + raise Exception("Sorry, this script requires Python 3!") + +import json +import os.path +import platform +import tarfile +import requests +import urllib.request + +from distutils.util import strtobool +from ftplib import FTP +from urllib.request import urlopen + + +def install_package(package_name): + try: + import pip + if hasattr(pip, 'main'): + pipcode = pip.main(['install', package]) + else: + pipcode = pip._internal.main(['install', package]) + return pipcode == 0 + except: + return False + + +distro_available = False + +try: + import distro + + distro_available = True +except: + distro_available = install_package("distro") + +try: + from bs4 import BeautifulSoup Review comment: That's a fair point, however still implies that the script contains hardcoded information about: -operating systems and versions we provide release for (centos, xenial, bionic, etc). Or do we have information available somewhere about this? -different releases for a given platform. (w/o JNI for eg.) And, as you highlighted above, we need to standardize the name of binaries. In my opinion that's a bit too much hardcoded information and restriction, but I'm open if we can somehow resolve the above two. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
