'__target_fqdn': self.target_host[2], IndexError: string index out of range #160

Closed
opened 2021-11-20 15:20:28 +00:00 by ungleich-gitea · 3 comments

Created by: 4nd3r

sorry about issue subject, couldn't figure out better title :>

i was testing @darko-poljak's inventory system.

this happened:

# cdist config -v -p -b -A
--8<-- snip --8<--
INFO: cdist: Total processing time for XX host(s): 13.602720975875854
ERROR: cdist: Failed to configure the following hosts: host1 host2 host3

nothing special about failed hosts - one debian wheezy, 2 jessies.
base config is identical to others. at least it should be :>

debug run:

# cdist config -d host1
DEBUG: cdist: Namespace(all_tagged_hosts=False, beta=False, command='config', conf_dir=None, debug=True, dry_run=False, func=<bound method type.commandline of <class 'cdist.config.Config'>>, has_all_tags=False, host=['host1'], hostfile=None, inventory_dir=None, jobs=None, manifest=None, out_path=None, parallel=False, remote_copy=None, remote_exec=None, tag=False, verbose=False)
INFO: cdist: version 4.3.2-177-gcce175e
DEBUG: cdist: Base root path for target host "host1" is "/tmp/tmpue8we34z/d67f249b90615ca158b1258712c3a9fc"
DEBUG: host1: remote_exec for host "host1": ssh -o User=root -o ControlPath=/tmp/tmpue8we34z/d67f249b90615ca158b1258712c3a9fc/ssh-control-path  -o ControlPersist=125  -o ControlMaster=auto
DEBUG: host1: remote_copy for host "host1": scp -o User=root -o ControlPath=/tmp/tmpue8we34z/d67f249b90615ca158b1258712c3a9fc/ssh-control-path  -o ControlPersist=125  -o ControlMaster=auto
DEBUG: host1: derived host_name for host "host1": host1.domain.tld
DEBUG: host1: derived host_fqdn for host "host1": host1.domain.tld
DEBUG: host1: Local mkdir: /tmp/tmpue8we34z/d67f249b90615ca158b1258712c3a9fc/data
Traceback (most recent call last):
  File "/opt/cdist/bin/../scripts/cdist", line 387, in <module>
    commandline()
  File "/opt/cdist/bin/../scripts/cdist", line 357, in commandline
    args.func(args)
  File "/opt/cdist/cdist/config.py", line 208, in commandline
    args, parallel=False)
  File "/opt/cdist/cdist/config.py", line 300, in onehost
    c = cls(local, remote, dry_run=args.dry_run, jobs=args.jobs)
  File "/opt/cdist/cdist/config.py", line 88, in __init__
    self.code = core.Code(self.local.target_host, self.local, self.remote)
  File "/opt/cdist/cdist/core/code.py", line 111, in __init__
    '__target_fqdn': self.target_host[2],
IndexError: string index out of range

using fqdn works:

# cdist config -v host1.domain.tld
--8<-- snip --8<--
INFO: cdist: Total processing time for 1 host(s): 9.917510986328125

problem were introduced somewhere in between 4.2.2 (last good) and 4.3.0.

did bisecting and got this:

dbcc94ab659c861cc9af416073f235da22f21c8c is the first bad commit
commit dbcc94ab659c861cc9af416073f235da22f21c8c
Author: Darko Poljak <darko.poljak@gmail.com>
Date:   Wed Aug 10 23:56:56 2016 +0200

Add derived env vars for target hostname and fqdn.

:040000 040000 5118a900ce74e9df055c40e3b4d4dd06c01fe5e9 aa00282eccddb18ec4208a37027395a1ba7bb284 M      cdist
:040000 040000 c71e04009f10ab8e2e553abc62d1ea5d60be9f14 8b6770892a8fdc97f535c916cf8d9ec1c94d5cff M      docs
*Created by: 4nd3r* sorry about issue subject, couldn't figure out better title :> i was testing @darko-poljak's inventory system. this happened: ``` # cdist config -v -p -b -A --8<-- snip --8<-- INFO: cdist: Total processing time for XX host(s): 13.602720975875854 ERROR: cdist: Failed to configure the following hosts: host1 host2 host3 ``` nothing special about failed hosts - one debian wheezy, 2 jessies. base config is identical to others. at least it should be :> debug run: ``` # cdist config -d host1 DEBUG: cdist: Namespace(all_tagged_hosts=False, beta=False, command='config', conf_dir=None, debug=True, dry_run=False, func=<bound method type.commandline of <class 'cdist.config.Config'>>, has_all_tags=False, host=['host1'], hostfile=None, inventory_dir=None, jobs=None, manifest=None, out_path=None, parallel=False, remote_copy=None, remote_exec=None, tag=False, verbose=False) INFO: cdist: version 4.3.2-177-gcce175e DEBUG: cdist: Base root path for target host "host1" is "/tmp/tmpue8we34z/d67f249b90615ca158b1258712c3a9fc" DEBUG: host1: remote_exec for host "host1": ssh -o User=root -o ControlPath=/tmp/tmpue8we34z/d67f249b90615ca158b1258712c3a9fc/ssh-control-path -o ControlPersist=125 -o ControlMaster=auto DEBUG: host1: remote_copy for host "host1": scp -o User=root -o ControlPath=/tmp/tmpue8we34z/d67f249b90615ca158b1258712c3a9fc/ssh-control-path -o ControlPersist=125 -o ControlMaster=auto DEBUG: host1: derived host_name for host "host1": host1.domain.tld DEBUG: host1: derived host_fqdn for host "host1": host1.domain.tld DEBUG: host1: Local mkdir: /tmp/tmpue8we34z/d67f249b90615ca158b1258712c3a9fc/data Traceback (most recent call last): File "/opt/cdist/bin/../scripts/cdist", line 387, in <module> commandline() File "/opt/cdist/bin/../scripts/cdist", line 357, in commandline args.func(args) File "/opt/cdist/cdist/config.py", line 208, in commandline args, parallel=False) File "/opt/cdist/cdist/config.py", line 300, in onehost c = cls(local, remote, dry_run=args.dry_run, jobs=args.jobs) File "/opt/cdist/cdist/config.py", line 88, in __init__ self.code = core.Code(self.local.target_host, self.local, self.remote) File "/opt/cdist/cdist/core/code.py", line 111, in __init__ '__target_fqdn': self.target_host[2], IndexError: string index out of range ``` using fqdn works: ``` # cdist config -v host1.domain.tld --8<-- snip --8<-- INFO: cdist: Total processing time for 1 host(s): 9.917510986328125 ``` problem were introduced somewhere in between 4.2.2 (last good) and 4.3.0. did bisecting and got this: ``` dbcc94ab659c861cc9af416073f235da22f21c8c is the first bad commit commit dbcc94ab659c861cc9af416073f235da22f21c8c Author: Darko Poljak <darko.poljak@gmail.com> Date: Wed Aug 10 23:56:56 2016 +0200 Add derived env vars for target hostname and fqdn. :040000 040000 5118a900ce74e9df055c40e3b4d4dd06c01fe5e9 aa00282eccddb18ec4208a37027395a1ba7bb284 M cdist :040000 040000 c71e04009f10ab8e2e553abc62d1ea5d60be9f14 8b6770892a8fdc97f535c916cf8d9ec1c94d5cff M docs ```
ungleich-gitea added the
bugfix
label 2021-11-20 15:20:28 +00:00
Author
Owner

Created by: 4nd3r

@darko-poljak thanks, no more failed hosts! fixed and closing.

*Created by: 4nd3r* @darko-poljak thanks, no more failed hosts! fixed and closing.
Author
Owner

Created by: darko-poljak

@4nd3r I found the problem. It should be now fixed. I pushed the fix to 'inventory' branch. Please test it with the same params and hosts.

*Created by: darko-poljak* @4nd3r I found the problem. It should be now fixed. I pushed the fix to 'inventory' branch. Please test it with the same params and hosts.
Author
Owner

Created by: darko-poljak

Can you also post debug output for the case it works? Thanks

*Created by: darko-poljak* Can you also post debug output for the case it works? Thanks
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ungleich-public/cdist#160
No description provided.