Example #1
0
 def post(self, content):
     LOG.info("post data to create node, content is: %s" % content)
     mac = content['mac']
     if not mac:
         return False
     local = content['local']
     ip = None
     if "ip" in content:
         ip = content['ip']
     #TODO(wentian): judge if first node is created by puppet agent
     return manager.build_host_data(mac, local, ip)
Example #2
0
    def post(self, content):
        mac_command = "ifconfig %s | awk '/HWaddr/{ print $5 }'" % \
                CONF.mimic_internal_interface
        ip_command = "ifconfig %s | awk '/inet addr:/{ print $2 }' | awk -F: '{print $2 }'" % CONF.mimic_internal_interface

        LOG.info("execute commands to get %s mac: %s" %
                 (CONF.mimic_internal_interface, mac_command))
        LOG.info("execute commands to get %s ip: %s" %
                 (CONF.mimic_internal_interface, ip_command))

        result1, mac = commands.getstatusoutput(mac_command)
        result1, ip = commands.getstatusoutput(ip_command)

        LOG.info("create first machine, mac: %s , ip: %s" % (mac, ip))
        data = manager.build_host_data(mac, "no", ip, build=False)

        LOG.info("create first machine finished begin to configuration")
        subprocess.Popen("puppet agent -vt 2>>&1 %s" %
                         CONF.uos_install_stage2_log,
                         shell=True)
        return data