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

 ##########
 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:
   I'm afraid I don't understand your last sentiment. Let's take a step back 
and look at the spirit of the ticket. Interrogating some service ( should be 
non specific ) to get a specific arch and operating system. We only support a 
small set of operating systems at the moment. We'd send this file over to a 
machine, let it take over by downloading tagged version, or installing the 
dependency. With that said if it can be done that way, and without installing 
dependencies on the user system that aren't bootstrap specific, then I think 
we're golden. 

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

Reply via email to