예제 #1
0
파일: test_ncf.py 프로젝트: ageorgop/ncf
    def test_get_all_techniques_metadata_with_args(self):
        """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called"""
        alternative_path = os.path.dirname(os.path.realpath(__file__)) + "/test_methods"
        metadata = ncf.get_all_techniques_metadata(alt_path=alternative_path)

        number = len(ncf.get_all_techniques_filenames(alternative_path))
        self.assertEquals(number, len(metadata))
예제 #2
0
파일: ncf_rudder.py 프로젝트: Webhuis/ncf
def write_one_technique_for_rudder(destination_path, bundle_name):
  write_category_xml(destination_path)
  techniques = ncf.get_all_techniques_metadata(alt_path='/var/rudder/configuration-repository/ncf')
  if bundle_name in techniques.keys():
    try:
      metadata = techniques[bundle_name]
      write_technique_for_rudder(destination_path, metadata)
    except Exception, e:
     print("Error: Unable to create Rudder Technique files related to ncf Technique "+bundle_name+" (" + str(e) + ")")
예제 #3
0
파일: ncf_rudder.py 프로젝트: frbayart/ncf
def write_all_techniques_for_rudder(root_path):
  write_category_xml(root_path)
  techniques = ncf.get_all_techniques_metadata()
  for technique, metadata in techniques.iteritems():
    try:
      write_technique_for_rudder(root_path, metadata)
    except Exception, e:
     print("Error: Unable to create Rudder Technique files related to ncf Technique "+technique+", skipping... (" + str(e) + ")")
     continue
예제 #4
0
파일: test_ncf.py 프로젝트: ikramBej/ncf
    def test_get_all_techniques_metadata(self):
        """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called"""
        metadata = ncf.get_all_techniques_metadata()
        data = metadata["data"]["techniques"]
        errors = metadata["errors"]
        all_metadata = len(data) + len(errors)

        all_files = len(ncf.get_all_techniques_filenames())

        self.assertEqual(all_files, all_metadata)
예제 #5
0
def get_techniques():
    """Get all techniques from ncf folder passed as parameter, or default ncf folder if not defined"""
    try:
        # We need to get path from url params, if not present put "" as default value
        path = get_path_from_args(request)
        techniques = ncf.get_all_techniques_metadata(alt_path=path)
        resp = jsonify(techniques)
        return resp
    except Exception as e:
        return format_error(e, "techniques fetching", 500)
예제 #6
0
파일: views.py 프로젝트: Normation/ncf
def get_techniques():
  """Get all techniques from ncf folder passed as parameter, or default ncf folder if not defined"""
  try:
    # We need to get path from url params, if not present put "" as default value
    path = get_path_from_args(request)
    techniques = ncf.get_all_techniques_metadata(alt_path = path)
    resp = jsonify( techniques )
    return resp
  except Exception as e:
    return format_error(e, "techniques fetching", 500)
예제 #7
0
  def test_get_all_techniques_metadata(self):
    """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called"""
    metadata = ncf.get_all_techniques_metadata()
    data = metadata["data"]
    errors = metadata["errors"]
    all_metadata = len(data) + len(errors)

    all_files = len(ncf.get_all_techniques_filenames())
 
    self.assertEquals(all_files, all_metadata)
예제 #8
0
def write_all_techniques_for_rudder(root_path):
    write_category_xml(root_path)
    techniques = ncf.get_all_techniques_metadata()
    for technique, metadata in techniques.iteritems():
        try:
            write_technique_for_rudder(root_path, metadata)
        except Exception, e:
            print(
                "Error: Unable to create Rudder Technique files related to ncf Technique "
                + technique + ", skipping...")
            continue
예제 #9
0
  def test_get_all_techniques_metadata_with_args(self):
    """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called"""
    alternative_path = os.path.dirname(os.path.realpath(__file__)) + "/test_methods"
    metadata = ncf.get_all_techniques_metadata(alt_path=alternative_path)
    data = metadata["data"]
    errors = metadata["errors"]
    all_metadata = len(data) + len(errors)

    all_files = len(ncf.get_all_techniques_filenames(alternative_path))
 
    self.assertEquals(all_files, all_metadata)
예제 #10
0
파일: views.py 프로젝트: fanf/ncf
def get_techniques():
  """Get all techniques from ncf folder passed as parameter, or default ncf folder if not defined"""
  # We need to get path from url params, if not present put "" as default value
  if "path" in request.args:
    path = request.args['path']
  else:
    path = ""

  techniques = ncf.get_all_techniques_metadata(alt_path = path)
  resp = jsonify( techniques )
  return resp
예제 #11
0
파일: test_ncf.py 프로젝트: DINKIN/ncf
    def test_get_all_techniques_metadata_with_args(self):
        """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called"""
        alternative_path = os.path.dirname(
            os.path.realpath(__file__)) + "/test_methods"
        metadata = ncf.get_all_techniques_metadata(alt_path=alternative_path)
        data = metadata["data"]
        errors = metadata["errors"]
        all_metadata = len(data) + len(errors)

        all_files = len(ncf.get_all_techniques_filenames(alternative_path))

        self.assertEqual(all_files, all_metadata)
예제 #12
0
파일: ncf_rudder.py 프로젝트: Kryndex/ncf
def write_all_techniques_for_rudder(root_path):
  write_category_xml(root_path)
  techniques = ncf.get_all_techniques_metadata(alt_path='/var/rudder/configuration-repository/ncf')['data']['techniques']
  ret = 0
  for technique, metadata in techniques.items():
    try:
      write_technique_for_rudder(root_path, metadata)
    except Exception as e:
      sys.stderr.write("Error: Unable to create Rudder Technique files related to ncf Technique "+technique+", skipping... (" + str(e) + ")\n")
      sys.stderr.write(traceback.format_exc())
      ret = 1
      continue
  exit(ret)
예제 #13
0
def write_all_techniques_for_rudder(root_path):
  write_category_xml(root_path)
  techniques = ncf.get_all_techniques_metadata(alt_path='/var/rudder/configuration-repository/ncf')['data']['techniques']
  ret = 0
  for technique, metadata in techniques.items():
    try:
      write_technique_for_rudder(root_path, metadata)
    except Exception as e:
      sys.stderr.write("Error: Unable to create Rudder Technique files related to ncf Technique "+technique+", skipping... (" + str(e) + ")\n")
      sys.stderr.write(traceback.format_exc())
      ret = 1
      continue
  exit(ret)
예제 #14
0
파일: ncf_rudder.py 프로젝트: Kryndex/ncf
def write_one_technique_for_rudder(destination_path, bundle_name):
  write_category_xml(destination_path)
  techniques = ncf.get_all_techniques_metadata(alt_path='/var/rudder/configuration-repository/ncf')['data']['techniques']
  if bundle_name in techniques.keys():
    try:
      metadata = techniques[bundle_name]
      write_technique_for_rudder(destination_path, metadata)
    except Exception as e:
      sys.stderr.write("Error: Unable to create Rudder Technique files related to ncf Technique "+bundle_name+" (" + str(e) + ")\n")
      sys.stderr.write(traceback.format_exc())
      exit(1)
  else:
    sys.stderr.write("Error: Unable to create Rudder Technique files related to ncf Technique "+bundle_name+", cannot find ncf Technique "+bundle_name + "\n")
    sys.stderr.write(traceback.format_exc())
    exit(1)
예제 #15
0
def write_one_technique_for_rudder(destination_path, bundle_name):
  write_category_xml(destination_path)
  techniques = ncf.get_all_techniques_metadata(alt_path='/var/rudder/configuration-repository/ncf')['data']['techniques']
  if bundle_name in techniques.keys():
    try:
      metadata = techniques[bundle_name]
      write_technique_for_rudder(destination_path, metadata)
    except Exception as e:
      sys.stderr.write("Error: Unable to create Rudder Technique files related to ncf Technique "+bundle_name+" (" + str(e) + ")\n")
      sys.stderr.write(traceback.format_exc())
      exit(1)
  else:
    sys.stderr.write("Error: Unable to create Rudder Technique files related to ncf Technique "+bundle_name+", cannot find ncf Technique "+bundle_name + "\n")
    sys.stderr.write(traceback.format_exc())
    exit(1)
예제 #16
0
def convert_all_to_dsc(root_path):
    techniques = ncf.get_all_techniques_metadata(
        alt_path=rudder_ncf_path)['data']['techniques']
    methods = ncf.get_all_generic_methods_metadata(
        alt_path=rudder_ncf_path)['data']['generic_methods']
    check_dsc_techniques_path()
    ret = 0
    for technique, metadata in techniques.items():
        try:
            convert_technique(metadata, methods)
        except Exception as e:
            sys.stderr.write(
                "Error: Unable to create Rudder Technique files related to ncf Technique "
                + technique + ", skipping... (" + str(e) + ")\n")
            sys.stderr.write(traceback.format_exc())
            ret = 1
            continue
    exit(ret)
예제 #17
0
def convert_one_to_dsc(destination_path, bundle_name):
    techniques = ncf.get_all_techniques_metadata(
        alt_path=rudder_ncf_path)['data']['techniques']
    methods = ncf.get_all_generic_methods_metadata(
        alt_path=rudder_ncf_path)['data']['generic_methods']
    check_dsc_techniques_path()
    if bundle_name in techniques.keys():
        try:
            metadata = techniques[bundle_name]
            convert_technique(metadata, methods)
        except Exception as e:
            sys.stderr.write(
                "Error: Unable to create Rudder Technique files related to ncf Technique "
                + bundle_name + " (" + str(e) + ")\n")
            sys.stderr.write(traceback.format_exc())
            exit(1)
    else:
        sys.stderr.write(
            "Error: Unable to create Rudder Technique files related to ncf Technique "
            + bundle_name + ", cannot find ncf Technique " + bundle_name +
            "\n")
        sys.stderr.write(traceback.format_exc())
        exit(1)
예제 #18
0
파일: test_ncf.py 프로젝트: ageorgop/ncf
    def test_get_all_techniques_metadata(self):
        """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called"""
        metadata = ncf.get_all_techniques_metadata()

        number = len(ncf.get_all_techniques_filenames())
        self.assertEquals(number, len(metadata))
예제 #19
0
    def test_get_all_techniques_metadata(self):
        """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called"""
        metadata = ncf.get_all_techniques_metadata()

        number = len(ncf.get_all_techniques_filenames())
        self.assertEquals(number, len(metadata))