コード例 #1
0
	def buildWithRemoteMapping(self):
		# TODO(jchaloup): read location of mappings from config file
		# TODO(jchaloup): change path to remote mappings to point to server
		ip2pp_location = "%s/data/import_path_to_provider_prefix_mapping.json" % getScriptDir(__file__)
		ip2pkg_location = "%s/data/import_path_to_package_name_mapping.json" % getScriptDir(__file__)

		raise NotImplementedError()
コード例 #2
0
    def buildWithRemoteMapping(self):
        # TODO(jchaloup): read location of mappings from config file
        # TODO(jchaloup): change path to remote mappings to point to server
        ip2pp_location = "%s/data/import_path_to_provider_prefix_mapping.json" % getScriptDir(
            __file__)
        ip2pkg_location = "%s/data/import_path_to_package_name_mapping.json" % getScriptDir(
            __file__)

        raise NotImplementedError()
コード例 #3
0
	def buildWithLocalMapping(self):
		# TODO(jchaloup): read location of mappings from config file
		ip2pp_location = "%s/data/import_path_to_provider_prefix_mapping.json" % getScriptDir(__file__)
		ip2pkg_location = "%s/data/import_path_to_package_name_mapping.json" % getScriptDir(__file__)
		native_packages_location = "%s/data/native_packages.json" % getScriptDir(__file__)

		# get mappings
		with open(ip2pp_location, "r") as f:
			ip2pp_mapping = json.load(f)

		with open(ip2pkg_location, "r") as f:
			ip2pkg_mapping = json.load(f)

		with open(native_packages_location, "r") as f:
			native_packages = json.load(f)

		return ImportPathParser(ip2pp_mapping, ip2pkg_mapping, native_packages["packages"])
コード例 #4
0
	def buildWithLocalMappingForIPPrefixDecomposer(self):
		# TODO(jchaloup): read location of mappings from config file
		ip2pp_location = "%s/data/import_path_to_provider_prefix_mapping.json" % getScriptDir(__file__)

		# get mappings
		with open(ip2pp_location, "r") as f:
			ip2pp_mapping = json.load(f)

		return ImportPathParser(ip2pp_mapping, {}, [])
コード例 #5
0
    def buildWithLocalMappingForIPPrefixDecomposer(self):
        # TODO(jchaloup): read location of mappings from config file
        ip2pp_location = "%s/data/import_path_to_provider_prefix_mapping.json" % getScriptDir(
            __file__)

        # get mappings
        with open(ip2pp_location, "r") as f:
            ip2pp_mapping = json.load(f)

        return ImportPathParser(ip2pp_mapping, {}, [])
コード例 #6
0
	def __init__(self):
		file_location = "%s/fakedata/nodes.json" % getScriptDir(__file__)
		self.data = {}
		with open(file_location, "r") as f:
			data = json.load(f)

		for line in data:
			parts = line["name"].split("-")
			name = "-".join(parts[:-2])
			self.data[name] = line
コード例 #7
0
ファイル: gosymbolsextractor.py プロジェクト: hodovska/lib
	def _getGoSymbols(self, path, imports_only=False):
		script_dir = getScriptDir(__file__) + "/."
		options = ""
		if imports_only:
			options = "-imports"

		so, se, rc = runCommand("%s/parseGo %s %s" % (script_dir, options, path))
		if rc != 0:
			return (1, se)

		return (0, so)
コード例 #8
0
    def buildWithLocalMapping(self):
        # TODO(jchaloup): read location of mappings from config file
        ip2pp_location = "%s/data/import_path_to_provider_prefix_mapping.json" % getScriptDir(
            __file__)
        ip2pkg_location = "%s/data/import_path_to_package_name_mapping.json" % getScriptDir(
            __file__)
        native_packages_location = "%s/data/native_packages.json" % getScriptDir(
            __file__)

        # get mappings
        with open(ip2pp_location, "r") as f:
            ip2pp_mapping = json.load(f)

        with open(ip2pkg_location, "r") as f:
            ip2pkg_mapping = json.load(f)

        with open(native_packages_location, "r") as f:
            native_packages = json.load(f)

        return ImportPathParser(ip2pp_mapping, ip2pkg_mapping,
                                native_packages["packages"])
コード例 #9
0
ファイル: gosymbolsextractor.py プロジェクト: hodovska/lib
    def _getGoSymbols(self, path, imports_only=False):
        script_dir = getScriptDir(__file__) + "/."
        options = ""
        if imports_only:
            options = "-imports"

        so, se, rc = runCommand("%s/parseGo %s %s" %
                                (script_dir, options, path))
        if rc != 0:
            return (1, se)

        return (0, so)
コード例 #10
0
ファイル: unit.py プロジェクト: ingvagabund/uniuni
    def __init__(self, config=None, config_vars=None, dry_run=False):

        self._dry_run = dry_run
        if not config:
            config = "%s/../config.yaml" % getScriptDir(__file__)

        if config_vars:
            self._config_data = yaml.load(
                renderTemplate(os.path.dirname(config),
                               os.path.basename(config), config_vars))
        else:
            self._config_data = yaml.load(open(config, 'r'))
コード例 #11
0
ファイル: helpers.py プロジェクト: ingvagabund/uniuni
    def __init__(self,
                 ansible_dir,
                 resource_file,
                 cluster_os,
                 kubeconfig_dest,
                 private_key=None,
                 log_file=None,
                 dry=False):

        self._dry = dry
        self._class_dir = getScriptDir(__file__)
        self._ansible_dir = ansible_dir
        self._resource_file = resource_file
        self._kubeconfig_dest = kubeconfig_dest
        self._log_file = log_file
        self._private_key = private_key
        self._cluster_os = cluster_os

        inventory_dir = os.path.join(self._ansible_dir, "inventory")
        if "INVENTORY" in os.environ:
            self._inventory = os.environ["INVENTORY"]

        if "INVENTORY" not in os.environ:
            if os.path.exists(inventory_dir):
                self._inventory = os.path.join(
                    self._ansible_dir, "inventory/central_ci_dynamic_hosts.py")
            else:
                self._inventory = os.path.join(self._class_dir,
                                               "central_ci_dynamic_hosts.py")

        self._playbooks_dir = os.path.join(self._class_dir, "playbook")

        data = json.load(open(resource_file))
        nodes = []
        masters = []

        for node in data["resources"]:
            nodes.append(node["ip"])
            if "masters" in node["metadata"]["ansible-group"]:
                masters.append(node["ip"])

        assert len(masters) > 0
        assert len(nodes) > 0

        self._cluster_resources = {}
        self._cluster_resources["nodes"] = nodes
        self._cluster_resources["masters"] = masters

        data
コード例 #12
0
ファイル: packagemanager.py プロジェクト: hodovska/lib
	def getPackages(self, distribution = "rawhide"):
		"""
		:param distribution: package distribution
		:type  distribution: string
		:returns: [string]
		:raises KeyError: if distribution not found
		"""
		if self._packages == {}:
			file_location = "%s/data/distribution_packages.json" % getScriptDir(__file__)
			with open(file_location, "r") as f:
				packages = json.load(f)
			for pkg in packages:
				for distro in pkg["distributions"]:
					try:
						self._packages[distro].append(pkg["package"])
					except KeyError:
						self._packages[distro] = [pkg["package"]]

		return self._packages[distribution]