F5Networks / f5-aws-cloudformation

CloudFormation Templates for quickly deploying BIG-IP services in Amazon Web Services EC2
112 stars 118 forks source link

BIG-IP v12.x RPM package file not in valid rpm base directory when AS3 RPM not in /var/config/rest/dowloads #103

Closed JeffGiroux closed 1 year ago

JeffGiroux commented 4 years ago

Do you already have an issue opened with F5 support?

No

Description

BIG-IP 12.1.5 will only install the F5 RPMs if they are located in /var/config/rest/downloads. The AWS template however downoads the RPM file and places in /config/cloud.

       "/config/cloud/f5-appsvcs-3.18.0-4.noarch.rpm": {
        "group": "root",
        "mode": "000755",
        "owner": "root",
        "source": "http://cdn.f5.com/product/cloudsolutions/f5-appsvcs-extension/v3.18.0/f5-appsvcs-3.18.0-4.noarch.rpm"
       },

Then you receive this error during onboard:

2020-04-26T01:22:41.096Z debug: [pid: 12782] [lib/bigIp.js] list localhost /shared/iapp/package-management-tasks/bc1631c4-dfd7-4ab2-9ba5-87ea0ea1e6f9 
2020-04-26T01:22:41.100Z debug: [pid: 12782] [lib/bigIp.js]  {"packageFilePath":"/config/cloud/f5-appsvcs-3.18.0-4.noarch.rpm","operation":"INSTALL","step":"INSTALL_PACKAGE","id":"bc1631c4-dfd7-4ab2-9ba5-87ea0ea1e6f9","status":"FAILED","startTime":"2020-04-25T18:22:31.088-0700","endTime":"2020-04-25T18:22:31.094-0700","errorMessage":"Failed to install /config/cloud/f5-appsvcs-3.18.0-4.noarch.rpm: java.lang.IllegalArgumentException: RPM package file not in valid rpm base directory","userReference":{"link":"https://localhost/mgmt/shared/authz/users/admin"},"identityReferences":[{"link":"https://localhost/mgmt/shared/authz/users/admin"}],"ownerMachineId":"f61e7c0d-4011-47d8-838c-ee11dc9b235c","generation":3,"lastUpdateMicros":1587864151094301,"kind":"shared:iapp:package-management-tasks:iapppackagemanagementtaskstate","selfLink":"https://localhost/mgmt/shared/iapp/package-management-tasks/bc1631c4-dfd7-4ab2-9ba5-87ea0ea1e6f9"}
2020-04-26T01:22:41.101Z silly: [pid: 12782] [lib/util.js] tryUntil: got error {"message":"Failed to install /config/cloud/f5-appsvcs-3.18.0-4.noarch.rpm: java.lang.IllegalArgumentException: RPM package file not in valid rpm base directory","stack":"Error: Failed to install /config/cloud/f5-appsvcs-3.18.0-4.noarch.rpm: java.lang.IllegalArgumentException: RPM package file not in valid rpm base directory\n    at /config/cloud/aws/node_modules/@f5devcentral/f5-cloud-libs/lib/bigIp.js:1180:37\n    at _fulfilled (/config/cloud/aws/node_modules/@f5devcentral/f5-cloud-libs/node_modules/q/q.js:854:54)\n    at self.promiseDispatch.done (/config/cloud/aws/node_modules/@f5devcentral/f5-cloud-libs/node_modules/q/q.js:883:30)\n    at Promise.promise.promiseDispatch (/config/cloud/aws/node_modules/@f5devcentral/f5-cloud-libs/node_modules/q/q.js:816:13)\n    at /config/cloud/aws/node_modules/@f5devcentral/f5-cloud-libs/node_modules/q/q.js:624:44\n    at runSingle (/config/cloud/aws/node_modules/@f5devcentral/f5-cloud-libs/node_modules/q/q.js:137:13)\n    at flush (/config/cloud/aws/node_modules/@f5devcentral/f5-cloud-libs/node_modules/q/q.js:125:13)\n    at nextTickCallbackWith0Args (node.js:489:9)\n    at process._tickCallback (node.js:418:13)"}
2020-04-26T01:22:41.101Z silly: [pid: 12782] [lib/util.js] typeof err object 
2020-04-26T01:22:41.101Z verbose: [pid: 12782] [lib/util.js] tryUntil error: Failed to install /config/cloud/f5-appsvcs-3.18.0-4.noarch.rpm: java.lang.IllegalArgumentException: RPM package file not in valid rpm base directory tries left: 44 
2020-04-26T01:22:41.102Z silly: [pid: 12782] [lib/util.js] tryUntil: retryOrReject: numRemaining: 44 , code: [Error: Failed to install /config/cloud/f5-appsvcs-3.18.0-4.noarch.rpm: java.lang.IllegalArgumentException: RPM package file not in valid rpm base directory] , message: Failed to install /config/cloud/f5-appsvcs-3.18.0-4.noarch.rpm: java.lang.IllegalArgumentException: RPM package file not in valid rpm base directory 

I should note, the Azure template works fine on v12. Notice the ARM template json code where it copies the RPM to /var/config/rest/downloads before installing. You can see the line of code here - https://github.com/F5Networks/f5-azure-arm-templates/blob/df1c759377b5112b03236b1292ff6cff2fcb2bf7/supported/standalone/3nic/new-stack/payg/azuredeploy.json#L873

mkdir -p /var/config/rest/downloads && cp ', variables('f5AS3Build'), ' /var/config/rest/downloads

The AWS CFT template needs to do the same type of procedure where it copies RPM to /var/config/rest/downloads first. It appears that in BIG-IP v13, v14, and v15 in AWS will install RPM successfully when in /config/cloud, but v12 will not.

Template

All AWS templates that place RPM in /config/cloud. Specifically, I tested standalone, 3nic, payg. https://github.com/F5Networks/f5-aws-cloudformation/tree/master/supported/standalone/3nic/existing-stack/payg

Repro Environment

Template does not automatically work with v12. To make template work with v12, you will need to edit a bit.

original (works for v14, v15)

"GATEWAY_MAC=`ifconfig eth1 | egrep ether | awk '{print tolower($2)}'`; ",
"GATEWAY_MAC2=`ifconfig eth2 | egrep ether | awk '{print tolower($2)}'`\n",
"INTERFACE_MAC=`ifconfig ${INTERFACE} | egrep ether | awk '{print tolower($2)}'`",
"/opt/aws/apitools/cfn-init/bin/cfn-init -v -s ",

after (works for v12, v13)

"GATEWAY_MAC=`ifconfig eth1 | egrep HWaddr | awk '{print tolower($5)}'`; ",
"GATEWAY_MAC2=`ifconfig eth2 | egrep HWaddr | awk '{print tolower($5)}'`\n",
"INTERFACE_MAC=`ifconfig ${INTERFACE} | egrep HWaddr | awk '{print tolower($5)}'`",
"/opt/aws/apitools/cfn-init-1.4-0.amzn1/bin/cfn-init -v -s ",

The tweaks above allow the template to onboard v12. But...it does NOT allow AS3 to install due to the "RPM package file not in valid rpm base directory" error. Therefore ALSO do the following changes.

old

"nohup /config/waitThenRun.sh",
"f5-rest-node /config/cloud/aws/node_modules/@f5devcentral/f5-cloud-libs/scripts/onboard.js",
"--install-ilx-package file:///config/cloud/f5-appsvcs-3.18.0-4.noarch.rpm",

new

"mkdir -p /var/config/rest/downloads/;",
"cp /config/cloud/f5-appsvcs-3.18.0-4.noarch.rpm /var/config/rest/downloads/;",
"nohup /config/waitThenRun.sh",
"f5-rest-node /config/cloud/aws/node_modules/@f5devcentral/f5-cloud-libs/scripts/onboard.js",
"--install-ilx-package file:///var/config/rest/downloads/f5-appsvcs-3.18.0-4.noarch.rpm",

Severity Level

3

JeffGiroux commented 4 years ago

Attaching my edited template with all workarounds for easier testing. It also points to an AMI ID for v12.1.5 in us-east-1 Virginia. Make sure all testing is done in us-east-1 region. My template is using a Good 1Gb AMI ID for v12.1.5 = ami-0f6a9261c48d07860.

f5-existing-stack-payg-3nic-bigip_tag5.5_v12.1.5-fix.template.txt

JeffGiroux commented 4 years ago

This can either be fixed by one...updating the templates. Or two...t can be fixed by updating AS3 to not require RPM to be in a specific location. The RPM should be able to be pulled from any directory for install. I think /var should NOT be used especially considering the /var directory usually has disk space warnings.

shyawnkarim commented 4 years ago

Thanks for reporting this. This bug is now being tracked internally with ID ESECLDTPLT-2057.

shyawnkarim commented 1 year ago

Closing due to age. These legacy templates are now in maintenance mode and are being replaced by our next-generation templates available in the Cloud Templates 2.0 GitHub repo.