Commit 0fccb279 authored by Simon Redman's avatar Simon Redman

Remove obsolete add_quagga_user

parent 86438ca5
...@@ -31,11 +31,6 @@ The topology is parsed using the information in `/var/emulab/boot/topomap` to ge ...@@ -31,11 +31,6 @@ The topology is parsed using the information in `/var/emulab/boot/topomap` to ge
For description of the non-standard fields used, see the NetworkGraph section of this document For description of the non-standard fields used, see the NetworkGraph section of this document
#### 2. add_quagga_user.py
This is an executable library which has a single method: `add_quagga_user_to_network`, which SSHes to every requested host and adds a user named `quagga`.
This script is useless in the current configuration since the proper user (actually `frr`) is baked into the Emulab disk image and comes from installing the frr package
#### 3. add_routable_ipv6_addrs.py #### 3. add_routable_ipv6_addrs.py
This is an executable library which provides several methods for gathering the necessary information to construct IPv6 Unique Local Addresses, construct them, and push them to the hosts This is an executable library which provides several methods for gathering the necessary information to construct IPv6 Unique Local Addresses, construct them, and push them to the hosts
......
#!/usr/bin/env python3
# Copyright (C) 2018 Simon Redman <sredman@cs.utah.edu>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import ssh_helper
import argparse
import getpass
import json
ADDUSER_COMMAND = "sudo adduser --disabled-password --gecos quagga quagga"
def add_quagga_user_to_network(sessions):
"""
Add the quagga user to every host in the network
:param sessions: logged-in sessions on which to run commands
:param ssh_options: options to pass to ssh, as per pxssh documentation
:return: list of passwords which were used to log in to the servers, where empty string means no password was used
"""
commands = [ADDUSER_COMMAND for i in range(len(hostnames))]
outputs = ssh_helper.run_commands_on_many_hosts(sessions, commands)
return outputs
if __name__ == "__main__":
parser = argparse.ArgumentParser("Send a command to create a user named \'quagga\' on every host in the provided NetJSON")
parser.add_argument("--in-file", action='store', type=str, required=True,
help="Path to the NetJSON file to parse")
parser.add_argument("--username", action='store', type=str, default=getpass.getuser(),
help="Username to use on all hosts. Defaults to current user's username")
args = parser.parse_args()
with open(args.in_file, 'r') as netjson_file:
netjson = json.load(netjson_file)
hostnames = [node['properties']['management-ip'] for node in netjson['nodes']]
usernames = [args.username for i in range(len(hostnames))]
sessions, passwords = ssh_helper.log_in_many_sessions(hostnames, usernames)
outputs = add_quagga_user_to_network(sessions)
pass
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