Esempio n. 1
0
 def __deploy_configuration(self):
     """
     Deploy the configuration to the container
     """
     for src, tag in self.image_config['configuration'].iteritems():
         if Output.VERBOSITY_NORMAL <= self.output.get_verbosity():
             self.line("<fg=cyan>%s</> <info>=></info> %s:%s" % (src, self.image_name, tag))
         if isinstance(tag, list):
             dockerfiles = []
             for t in tag:
                 dockerfiles.extend(Dockerfile.find_by_image_and_tag(self.dockerfile, self.image_name, t))
         else:
             dockerfiles = Dockerfile.find_by_image_and_tag(self.dockerfile, self.image_name, tag)
         dockerfiles = [os.path.dirname(image_path) for image_path in dockerfiles]
         self.__copy_configuration(dockerfiles, src)
Esempio n. 2
0
 def __clear_configuration(self):
     """
     Remove the old configuration
     """
     dockerfiles = Dockerfile.find_by_image_and_tag(self.dockerfile, self.image_name, '*')
     dockerfiles = [os.path.dirname(image_path) for image_path in dockerfiles]
     for dest in dockerfiles:
         dest = os.path.abspath(os.path.join(dest, 'conf/'))
         if os.path.exists(dest):
             if Output.VERBOSITY_VERY_VERBOSE <= self.output.get_verbosity():
                 self.line('<fg=red>delete configuration :</> %s' % dest)
             remove_tree(dest, 0)
Esempio n. 3
0
 def __deploy_configuration(self):
     """
     Deploy the configuration to the container
     """
     for src, tag in self.image_config['configuration'].iteritems():
         if Output.VERBOSITY_NORMAL <= self.output.get_verbosity():
             self.line("<fg=cyan>%s</> <info>=></info> %s:%s" %
                       (src, self.image_name, tag))
         if isinstance(tag, list):
             dockerfiles = []
             for t in tag:
                 dockerfiles.extend(
                     Dockerfile.find_by_image_and_tag(
                         self.dockerfile, self.image_name, t))
         else:
             dockerfiles = Dockerfile.find_by_image_and_tag(
                 self.dockerfile, self.image_name, tag)
         dockerfiles = [
             os.path.dirname(image_path) for image_path in dockerfiles
         ]
         self.__copy_configuration(dockerfiles, src)
Esempio n. 4
0
    def __deploy_base_layout(self):
        """
        Deploy localscripts

        copy tar to various containers
        """
        if os.path.exists('baselayout.tar') and self.image_config['baselayout']:
            dockerfiles = Dockerfile.find_by_image(self.dockerfile, "Dockerfile", [self.image_name])
            dockerfiles = [os.path.dirname(image_path) for image_path in dockerfiles]
            for target_path in dockerfiles:
                if Output.VERBOSITY_VERBOSE <= self.output.get_verbosity():
                    self.line('<comment>copy baselayout to </comment> %s ' % target_path)
                shutil.copy2('baselayout.tar', target_path)
Esempio n. 5
0
 def __clear_configuration(self):
     """
     Remove the old configuration
     """
     dockerfiles = Dockerfile.find_by_image_and_tag(self.dockerfile,
                                                    self.image_name, '*')
     dockerfiles = [
         os.path.dirname(image_path) for image_path in dockerfiles
     ]
     for dest in dockerfiles:
         dest = os.path.abspath(os.path.join(dest, 'conf/'))
         if os.path.exists(dest):
             if Output.VERBOSITY_VERY_VERBOSE <= self.output.get_verbosity(
             ):
                 self.line('<fg=red>delete configuration :</> %s' % dest)
             remove_tree(dest, 0)
Esempio n. 6
0
    def __deploy_base_layout(self):
        """
        Deploy localscripts

        copy tar to various containers
        """
        if os.path.exists(
                'baselayout.tar') and self.image_config['baselayout']:
            dockerfiles = Dockerfile.find_by_image(self.dockerfile,
                                                   "Dockerfile",
                                                   [self.image_name])
            dockerfiles = [
                os.path.dirname(image_path) for image_path in dockerfiles
            ]
            for target_path in dockerfiles:
                if Output.VERBOSITY_VERBOSE <= self.output.get_verbosity():
                    self.line('<comment>copy baselayout to </comment> %s ' %
                              target_path)
                shutil.copy2('baselayout.tar', target_path)