Bug 2116489

Summary: [Agent]: unable to create agent.iso when providing agent-config (without networkConfig) and manifests files together
Product: OpenShift Container Platform Reporter: Manoj Hans <mhans>
Component: InstallerAssignee: Pawan Pinjarkar <ppinjark>
Installer sub component: Agent based installation QA Contact: Manoj Hans <mhans>
Status: CLOSED NOTABUG Docs Contact:
Severity: high    
Priority: high CC: asakthiv, ppinjark, zbitter
Version: 4.11   
Target Milestone: ---   
Target Release: 4.12.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-09-26 21:26:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Manoj Hans 2022-08-08 15:40:24 UTC
Description: unable to create agent.iso when providing agent-config and manifests files (including nmstateconfig.yaml) together.

Here is the content of agent-config.yaml
--------------------------------------------
kind: AgentConfig
metadata:
  name: sno-cluster
spec:
  rendezvousIP: 192.168.111.80
  hosts:
    - hostname: master-0
      role: master
      rootDeviceHints:
       deviceName: /dev/sdb
      interfaces:
       - name: eno1
         macAddress: 00:ef:44:21:e6:a5
--------------------------------------------

How reproducible:

always

Repro Steps: 

1) Get the latest agent-installer and build

git clone -b agent-installer https://github.com/openshift/installer.git
cd installer/
hack/build.sh

2) Create agent.iso using agent-config and all manifests files including nmstateconfig.


Expected: Agent.iso should be created without any issue.
Actual: Unable to create agent.iso image, below are the logs:

INFO[0001] Start configuring static network for 1 hosts  pkg=manifests
ERRO[0001] <nmstatectl gc> failed, errorCode 1, stderr Traceback (most recent call last):
  File "/usr/bin/nmstatectl", line 11, in <module>
    load_entry_point('nmstate==1.2.1', 'console_scripts', 'nmstatectl')()
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 74, in main
    return args.func(args)
  File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 390, in run_gen_config
    if statedata[0] == "{":
IndexError: string index out of range
, input yaml <>  pkg=manifests
ERRO[0001] Failed to create static config for host       error="<nmstatectl gc> failed, errorCode 1, stderr Traceback (most recent call last):\n  File \"/usr/bin/nmstatectl\", line 11, in <module>\n    load_entry_point('nmstate==1.2.1', 'console_scripts', 'nmstatectl')()\n  File \"/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py\", line 74, in main\n    return args.func(args)\n  File \"/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py\", line 390, in run_gen_config\n    if statedata[0] == \"{\":\nIndexError: string index out of range\n, input yaml <>" pkg=manifests
ERROR failed to write asset (Agent Installer ISO) to disk: image reader not available 
FATAL failed to fetch Agent Installer ISO: failed to fetch dependency of "Agent Installer ISO": failed to generate asset "Agent Installer Ignition": failed to create StaticNetwork config data: <nmstatectl gc> failed, errorCode 1, stderr Traceback (most recent call last): 
FATAL   File "/usr/bin/nmstatectl", line 11, in <module> 
FATAL     load_entry_point('nmstate==1.2.1', 'console_scripts', 'nmstatectl')() 
FATAL   File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 74, in main 
FATAL     return args.func(args)                   
FATAL   File "/usr/lib/python3.6/site-packages/nmstatectl/nmstatectl.py", line 390, in run_gen_config 
FATAL     if statedata[0] == "{":                  
FATAL IndexError: string index out of range        
FATAL , input yaml <>

Comment 1 Zane Bitter 2022-08-17 02:21:49 UTC
Looks like we are trying to pass an empty string to nmstatectl. We should detect that earlier and neither create the NMStateConfig resource if there is no networkConfig provided in agent-config, nor call nmstatectl to generate the keyfiles if the NMStateConfig's nmstate field is empty.

Comment 2 Pawan Pinjarkar 2022-09-26 21:26:13 UTC
Closing as this bug is no longer reproducible.