2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-29 00:31:09 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Jarrod Johnson ce1d89c741 Set nodename as hostname prior to post for el class distros 2021-11-04 07:56:04 -04:00
Jarrod Johnson cbee00d3bb Fix initial collective join
Initial collective join combined
with the orderly collective startup
hit a chicken and egg problem.

Disable initting on first enrollment
to let enrollment drive
that specific initialization to
restore behavior.
2021-07-19 10:26:05 -04:00
Jarrod Johnson 14bb841b2d Fix nodebmcreset partial success
The error handling is improved, to
catch both noderange global issues as well
as partial completions.
2021-06-08 09:13:56 -04:00
Jarrod Johnson 03a75ec67d Error if noderange includes too many )
By default, pyparsing consumes only as much of the
input as matches the grammar. Tell it to consume all
of the noderange and error if there's more string than
matches our grammar.
2021-06-04 14:21:45 -04:00
Jarrod Johnson 269300119a Skip newer agent behaviors with incompatible old ssh
The previous attempt to support older ssh failed to completely
enact old behavior when needed.
2021-06-04 13:41:47 -04:00
6 changed files with 20 additions and 6 deletions
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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 ('<', '>'):
+7 -3
View File
@@ -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: