mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-29 08:41:00 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ce1d89c741 | |||
| cbee00d3bb | |||
| 14bb841b2d | |||
| 03a75ec67d | |||
| 269300119a |
@@ -47,14 +47,14 @@ exitcode = 0
|
||||
errorNodes = set([])
|
||||
session.stop_if_noderange_over(noderange, options.maxnodes)
|
||||
success = session.simple_noderange_command(noderange, 'configuration/management_controller/reset', 'reset', key='state', errnodes=errorNodes) # = 0 if successful
|
||||
if success != 0:
|
||||
sys.exit(success)
|
||||
|
||||
# Determine which nodes were successful and print them
|
||||
|
||||
allNodes = set([])
|
||||
|
||||
for node in session.read('/noderange/{0}/nodes/'.format(noderange)):
|
||||
if 'error' in node and success != 0:
|
||||
sys.exit(success)
|
||||
allNodes.add(node['item']['href'].replace("/", ""))
|
||||
|
||||
goodNodes = allNodes - errorNodes
|
||||
|
||||
@@ -12,6 +12,8 @@ export confluent_mgr confluent_profile nodename
|
||||
cp -a /etc/confluent /mnt/sysimage/etc
|
||||
chmod -R og-rwx /mnt/sysimage/etc/confluent
|
||||
cp /tmp/functions /mnt/sysimage/etc/confluent/
|
||||
hostnamectl set-hostname $nodename
|
||||
cp /etc/hostname /mnt/sysimage/etc/hostname
|
||||
. /tmp/functions
|
||||
if [ -f /tmp/cryptboot ]; then
|
||||
cp /tmp/cryptboot /mnt/sysimage/tmp/
|
||||
|
||||
@@ -12,6 +12,8 @@ export confluent_mgr confluent_profile nodename
|
||||
cp -a /etc/confluent /mnt/sysimage/etc
|
||||
chmod -R og-rwx /mnt/sysimage/etc/confluent
|
||||
cp /tmp/functions /mnt/sysimage/etc/confluent/
|
||||
hostnamectl set-hostname $nodename
|
||||
cp /etc/hostname /mnt/sysimage/etc/hostname
|
||||
. /tmp/functions
|
||||
if [ -f /tmp/cryptboot ]; then
|
||||
cp /tmp/cryptboot /mnt/sysimage/tmp/
|
||||
|
||||
@@ -244,6 +244,7 @@ def get_myname():
|
||||
def handle_connection(connection, cert, request, local=False):
|
||||
global currentleader
|
||||
global retrythread
|
||||
global initting
|
||||
connection.settimeout(5)
|
||||
operation = request['operation']
|
||||
if cert:
|
||||
@@ -395,6 +396,11 @@ def handle_connection(connection, cert, request, local=False):
|
||||
tlvdata.send(connection, {'error': 'Invalid token'})
|
||||
connection.close()
|
||||
return
|
||||
if not list(cfm.list_collective()):
|
||||
# First enrollment of a collective, since the collective doesn't
|
||||
# quite exist, then set initting false to let the enrollment action
|
||||
# drive this particular initialization
|
||||
initting = False
|
||||
myrsp = base64.b64encode(myrsp)
|
||||
fprint = util.get_fingerprint(cert)
|
||||
myfprint = util.get_fingerprint(mycert)
|
||||
|
||||
@@ -106,7 +106,7 @@ class NodeRange(object):
|
||||
self.endpage = None
|
||||
self.cfm = config
|
||||
try:
|
||||
elements = _parser.parseString("(" + noderange + ")").asList()[0]
|
||||
elements = _parser.parseString("(" + noderange + ")", parseAll=True).asList()[0]
|
||||
except pp.ParseException as pe:
|
||||
raise Exception("Invalid syntax")
|
||||
if noderange[0] in ('<', '>'):
|
||||
|
||||
@@ -34,7 +34,7 @@ def normalize_uid():
|
||||
|
||||
def assure_agent():
|
||||
if sshver() <= 7.6:
|
||||
return
|
||||
return False
|
||||
global agent_pid
|
||||
if agent_pid is None:
|
||||
sai = subprocess.check_output(['ssh-agent'])
|
||||
@@ -51,6 +51,7 @@ def assure_agent():
|
||||
if k == 'SSH_AGENT_PID':
|
||||
agent_pid = v
|
||||
os.environ[k] = v
|
||||
return True
|
||||
|
||||
def get_passphrase():
|
||||
if sshver() <= 7.6:
|
||||
@@ -90,9 +91,11 @@ def initialize_ca():
|
||||
|
||||
|
||||
def prep_ssh_key(keyname):
|
||||
assure_agent()
|
||||
if keyname in ready_keys:
|
||||
return
|
||||
if not assure_agent():
|
||||
ready_keys[keyname] = 1
|
||||
return
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
try:
|
||||
askpass = os.path.join(tmpdir, 'askpass.sh')
|
||||
@@ -121,8 +124,9 @@ def sign_host_key(pubkey, nodename, principals=()):
|
||||
principals.add(nodename)
|
||||
principals = ','.join(sorted(principals))
|
||||
flags = '-Us' if sshver() > 7.6 else '-s'
|
||||
keyname = '/etc/confluent/ssh/ca.pub' if flags == '-Us' else '/etc/confluent/ssh/ca'
|
||||
subprocess.check_call(
|
||||
['ssh-keygen', flags, '/etc/confluent/ssh/ca.pub', '-I', nodename,
|
||||
['ssh-keygen', flags, keyname, '-I', nodename,
|
||||
'-n', principals, '-h', pkeyname])
|
||||
certname = pkeyname.replace('.pub', '-cert.pub')
|
||||
with open(certname) as cert:
|
||||
|
||||
Reference in New Issue
Block a user