Ejemplo n.º 1
0
    def initialize(self):
        super(short_term_app, self).initialize()

        docker_name = DockerImage.full_name_from_component(
            self.config["docker_repo_name"],
            self.config["docker_repo_tag"])
        # Private to this instance, outside of __init__
        prep_changes = DockerCmd(self, "run",
                                 ["-d", docker_name, self.config["run_cmd"]],
                                 self.config['docker_run_timeout'])

        results = prep_changes.execute()
        if results.exit_status:
            raise error.TestNAError("Problems during initialization of"
                                    " test: %s" % results)
        else:
            c_id = results.stdout.strip()
            cont = self.sub_stuff["conts_obj"].list_containers_with_cid(c_id)
            if cont == []:
                raise error.TestNAError("Problems during initialization of"
                                        " test: Failed to find container with"
                                        "id %s." % c_id)
            self.sub_stuff["container"] = cont[0]
            self.sub_stuff["containers"].append(self.sub_stuff["container"])

        if self.check_if_cmd_finished:
            self.wait_for_container_death(cont[0])
Ejemplo n.º 2
0
    def complete_docker_command_line(self):
        registry_addr = self.config["docker_registry_host"]
        repository = self.config["docker_repo_name"]
        user = self.config["docker_registry_user"]
        tag = self.config["docker_repo_tag"]

        format_full_name = DockerImage.full_name_from_component(repository,
                                                                tag,
                                                                registry_addr,
                                                                user)
        self.sub_stuff["img_fn"] = format_full_name

        full_name_wo_tag = DockerImage.full_name_from_component(repository,
                                                                None,
                                                                registry_addr,
                                                                user)

        return ["--tag=%s" % (tag), full_name_wo_tag]
Ejemplo n.º 3
0
 def lookup_image_id(self, image_name, image_tag):
     di = DockerImages(self.parent_subtest)
     fqin = DockerImage.full_name_from_component(image_name, image_tag)
     imglst = di.list_imgs_with_full_name(fqin)
     try:
         # Don't care about duplicate ID's
         return imglst[0].long_id
     except IndexError:
         return None  # expected by some sub-subtests
Ejemplo n.º 4
0
 def lookup_image_id(self, image_name, image_tag):
     di = DockerImages(self)
     fqin = DockerImage.full_name_from_component(image_name, image_tag)
     imglst = di.list_imgs_with_full_name(fqin)
     try:
         # Don't care about duplicate ID's
         return imglst[0].long_id
     except IndexError:
         return None  # expected by some sub-subtests
Ejemplo n.º 5
0
 def generate_special_name(self):
     img = self.sub_stuff['image_list'][0]
     tag = "%s_%s" % (img.tag, utils.generate_random_string(8))
     repo = img.repo
     registry = img.repo_addr
     registry_user = img.user
     new_img_name = DockerImage.full_name_from_component(repo, tag,
                                                         registry,
                                                         registry_user)
     return new_img_name
Ejemplo n.º 6
0
 def generate_special_name(self):
     name_prefix = self.config["tag_repo_name_prefix"]
     img = self.sub_stuff['image_list'][0]
     tag = img.tag
     repo = img.repo
     registry = img.repo_addr
     reg_user = "******" % (name_prefix, utils.generate_random_string(8))
     new_img_name = DockerImage.full_name_from_component(repo, tag,
                                                         registry,
                                                         reg_user)
     return new_img_name
Ejemplo n.º 7
0
    def complete_docker_command_line(self):
        registry_addr = self.config["docker_registry_host"]
        repository = self.config["docker_repo_name"]
        tag = self.config["docker_repo_tag"]
        user = self.config["docker_registry_user"]

        full_name = DockerImage.full_name_from_component(repository,
                                                         tag,
                                                         registry_addr,
                                                         user)
        self.sub_stuff["img_fn"] = full_name

        return [full_name]
Ejemplo n.º 8
0
 def generate_special_name(self):
     img = self.sub_stuff['image_list'][0]
     tag = img.tag
     repo = img.repo
     registry = "%s.%s.%s.%s:%s" % ("".join(random.sample(string.digits, 2)),
                                    "".join(random.sample(string.digits, 2)),
                                    "".join(random.sample(string.digits, 2)),
                                    "".join(random.sample(string.digits, 2)),
                                    "".join(random.sample(string.digits, 4)))
     registry_user = img.user
     new_img_name = DockerImage.full_name_from_component(repo, tag,
                                                         registry,
                                                         registry_user)
     return new_img_name
Ejemplo n.º 9
0
 def generate_special_name(self):
     """ keep the name, only get unique tag """
     img = self.sub_stuff['image_list'][0]
     _tag = "%s_%s" % (img.tag, utils.generate_random_string(8))
     if self.config['gen_lower_only']:
         _tag = _tag.lower()
     else:
         _tag += '_UP'  # guarantee some upper-case
     repo = img.repo
     registry = img.repo_addr
     registry_user = img.user
     new_img_name = DockerImage.full_name_from_component(
         repo, _tag, registry, registry_user)
     return new_img_name
Ejemplo n.º 10
0
 def generate_special_name(self):
     name_prefix = self.config["tag_repo_name_prefix"]
     img = self.sub_stuff['image_list'][0]
     tag = img.tag
     repo = "%s_%s" % (name_prefix, utils.generate_random_string(8))
     if self.config['gen_lower_only']:
         repo = repo.lower()
     else:
         repo += '_UP'  # guarantee some upper-case
     registry = img.repo_addr
     registry_user = img.user
     new_img_name = DockerImage.full_name_from_component(
         repo, tag, registry, registry_user)
     return new_img_name
Ejemplo n.º 11
0
 def generate_special_name(self):
     img = self.sub_stuff['image_list'][0]
     tag = img.tag
     repo = img.repo
     fmt = "%s.%s.%s.%s:%s"
     registry = fmt % ("".join(random.sample(string.digits, 2)), "".join(
         random.sample(string.digits, 2)), "".join(
             random.sample(string.digits, 2)), "".join(
                 random.sample(string.digits, 2)), "".join(
                     random.sample(string.digits, 4)))
     registry_user = img.user
     new_img_name = DockerImage.full_name_from_component(
         repo, tag, registry, registry_user)
     return new_img_name
Ejemplo n.º 12
0
 def generate_special_name(self):
     img = self.sub_stuff['image_list'][0]
     _tag = "%s_%s" % (img.tag, utils.generate_random_string(8))
     if self.config['gen_lower_only']:
         _tag = _tag.lower()
     else:
         _tag += '_UP'  # guarantee some upper-case
     repo = img.repo
     registry = img.repo_addr
     registry_user = img.user
     new_img_name = DockerImage.full_name_from_component(repo,
                                                         _tag,
                                                         registry,
                                                         registry_user)
     return new_img_name
Ejemplo n.º 13
0
 def generate_special_name(self):
     name_prefix = self.config["tag_repo_name_prefix"]
     img = self.sub_stuff['image_list'][0]
     tag = img.tag
     repo = img.repo
     registry = img.repo_addr
     reg_user = "******" % (name_prefix, utils.generate_random_string(8))
     if self.config['gen_lower_only']:
         reg_user = reg_user.lower()
     else:
         reg_user += '_UP'  # guarantee some upper-case
     new_img_name = DockerImage.full_name_from_component(repo, tag,
                                                         registry,
                                                         reg_user)
     return new_img_name