Replace all reference to vifib by SlapOS Master.

parent 700abe58
...@@ -67,12 +67,12 @@ class Parser(OptionParser): ...@@ -67,12 +67,12 @@ class Parser(OptionParser):
default='eth0', default='eth0',
type=str), type=str),
Option("--master-url", Option("--master-url",
help="URL of vifib master", help="URL of SlapOS master",
default='https://slap.vifib.com', default='https://slap.vifib.com',
type=str), type=str),
Option("--master-url-web", Option("--master-url-web",
help="URL of vifib master webservice to register certificates", help="URL of SlapOS Master webservice to register certificates",
default='https://www.vifib.net', default='https://www.slapos.org',
type=str), type=str),
Option("--partition-number", Option("--partition-number",
help="Number of partition on computer", help="Number of partition on computer",
...@@ -87,11 +87,11 @@ class Parser(OptionParser): ...@@ -87,11 +87,11 @@ class Parser(OptionParser):
default='', default='',
type=str), type=str),
Option("--login", Option("--login",
help="User login on Vifib master webservice", help="User login on SlapOS Master webservice",
default=None, default=None,
type=str), type=str),
Option("--password", Option("--password",
help="User password on Vifib master webservice", help="User password on SlapOs Master webservice",
default=None, default=None,
type=str), type=str),
Option("-t", "--create-tap", Option("-t", "--create-tap",
...@@ -124,14 +124,14 @@ Partition and attach it to primary interface. Requires primary interface to be \ ...@@ -124,14 +124,14 @@ Partition and attach it to primary interface. Requires primary interface to be \
def get_login(): def get_login():
"""Get user id and encode it for basic identification""" """Get user id and encode it for basic identification"""
login = raw_input("Vifib Login: ") login = raw_input("SlapOS Master Login: ")
password = getpass() password = getpass()
identification = base64.encodestring('%s:%s' % (login, password))[:-1] identification = base64.encodestring('%s:%s' % (login, password))[:-1]
return identification return identification
def check_login(identification, master_url_web): def check_login(identification, master_url_web):
"""Check if logged correctly on vifib""" """Check if logged correctly on SlapOS Master"""
request = urllib2.Request(master_url_web) request = urllib2.Request(master_url_web)
# Prepare header for basic authentification # Prepare header for basic authentification
authheader = "Basic %s" % identification authheader = "Basic %s" % identification
...@@ -143,7 +143,7 @@ def check_login(identification, master_url_web): ...@@ -143,7 +143,7 @@ def check_login(identification, master_url_web):
def get_certificates(identification, node_name, master_url_web): def get_certificates(identification, node_name, master_url_web):
"""Download certificates on vifib master""" """Download certificates from SlapOS Master"""
register_server_url = '/'.join([master_url_web, ("add-a-server/WebSection_registerNewComputer?dialog_id=WebSection_viewServerInformationDialog&dialog_method=WebSection_registerNewComputer&title={}&object_path=/erp5/web_site_module/hosting/add-a-server&update_method=&cancel_url=https%3A//www.vifib.net/add-a-server/WebSection_viewServerInformationDialog&Base_callDialogMethod=&field_your_title=Essai1&dialog_category=None&form_id=view".format(node_name))]) register_server_url = '/'.join([master_url_web, ("add-a-server/WebSection_registerNewComputer?dialog_id=WebSection_viewServerInformationDialog&dialog_method=WebSection_registerNewComputer&title={}&object_path=/erp5/web_site_module/hosting/add-a-server&update_method=&cancel_url=https%3A//www.vifib.net/add-a-server/WebSection_viewServerInformationDialog&Base_callDialogMethod=&field_your_title=Essai1&dialog_category=None&form_id=view".format(node_name))])
request = urllib2.Request(register_server_url) request = urllib2.Request(register_server_url)
# Prepare header for basic authentification # Prepare header for basic authentification
...@@ -155,7 +155,7 @@ def get_certificates(identification, node_name, master_url_web): ...@@ -155,7 +155,7 @@ def get_certificates(identification, node_name, master_url_web):
def parse_certificates(source): def parse_certificates(source):
"""Parse html gotten from vifib to make certificate and key files""" """Parse html gotten from SlapOS Master to make certificate and key files"""
c_start = source.find("Certificate:") c_start = source.find("Certificate:")
c_end = source.find("</textarea>", c_start) c_end = source.find("</textarea>", c_start)
k_start = source.find("-----BEGIN PRIVATE KEY-----") k_start = source.find("-----BEGIN PRIVATE KEY-----")
...@@ -320,11 +320,11 @@ class Config: ...@@ -320,11 +320,11 @@ class Config:
self.logger.debug("Ipv6 Interface: %s" %self.ipv6_interface) self.logger.debug("Ipv6 Interface: %s" %self.ipv6_interface)
def register(config): def register(config):
"""Register new computer on VIFIB and generate slapos.cfg""" """Register new computer on SlapOS Master and generate slapos.cfg"""
# Get User identification and check them # Get User identification and check them
if config.login == None : if config.login == None :
while True : while True :
print ("Please enter your Vifib login") print ("Please enter your SlapOS Master login")
user_id = get_login() user_id = get_login()
if check_login(user_id, config.master_url_web): if check_login(user_id, config.master_url_web):
break break
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment