(self, new=False)
return json_obj
Generate runc spec file
Generate runc spec file
Generate runc spec file
def _load_spec(self, new=False):
        """Generate runc spec file"""
        if FileUtil(self._container_specfile).size() != -1 and new:
            FileUtil(self._container_specfile).register_prefix()
            FileUtil(self._container_specfile).remove()

        if FileUtil(self._container_specfile).size() == -1:
            cmd_l = [self.executable, "spec", "--rootless", ]
            status = subprocess.call(cmd_l, shell=False, stderr=Msg.chlderr,
                                     close_fds=True,
                                     cwd=os.path.realpath(\
                                         self._container_specdir))
            if status:
                return False

        json_obj = None
        infile = None
        try:
            infile = open(self._container_specfile, 'r')
            json_obj = json.load(infile)
        except (IOError, OSError, AttributeError, ValueError, TypeError):
            json_obj = None

        if infile:
            infile.close()

        self._container_specjson = json_obj
        return json_obj
def _load_spec ( self , new = False ) : if FileUtil ( self . _container_specfile ) . size ( ) != - 1 and new : FileUtil ( self . _container_specfile ) . register_prefix ( ) FileUtil ( self . _container_specfile ) . remove ( ) if FileUtil ( self . _container_specfile ) . size ( ) == - 1 : cmd_l = [ self . executable , "spec" , "--rootless" , ] status = subprocess . call ( cmd_l , shell = False , stderr = Msg . chlderr , close_fds = True , cwd = os . path . realpath ( self . _container_specdir ) ) if status : return False json_obj = None infile = None try : infile = open ( self . _container_specfile , 'r' ) json_obj = json . load ( infile ) except ( IOError , OSError , AttributeError , ValueError , TypeError ) : json_obj = None if infile : infile . close ( ) self . _container_specjson = json_obj return json_obj