Esempio n. 1
0
    def write_config(self):
        """ write configuration on dom0 """
        file_content = ""
        attrs = self.config.__dict__
        for attr in sorted(attrs):
            ## auto and configfile attributes are not part of xen
            if attr == "auto" or attr == "configfile":
                continue

            ## format content with python syntax
            file_content = "%s%s" % (file_content,
                                     pygen.dump_(attr, attrs[attr]))

        # write configuration on dom0
        filename = self.config.configfile
        fapi.write_file(self.dom0.srv_ip,
                        filename, file_content,
                        use_sudo=True)
        return True
Esempio n. 2
0
def write_file(self, filename, file_content, mode = "w", use_sudo = False):
    """ write content to a file  """
    return __fapi.write_file(self.srv_ip, filename, file_content,
                             mode = mode, use_sudo = use_sudo)