コード例 #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
ファイル: test_ncf.py プロジェクト: FlorianHeigl/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"]
    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
ファイル: test_ncf.py プロジェクト: FlorianHeigl/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.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))