Bluemix cf push error with manifest: expected services to be a list of strings - ibm-cloud

I'm trying to push an app to Bluemix on a Linux OS. However, the command line returns an error involving the manifest file:
Error reading manifest file:
Expected services to be a list of strings.
Here is the code for the manifest file:
applications:
- name: IdeaSocial
memory: 1024M
instances: 1
host: IdeaSocial
domain: mybluemix.net
path: .
services:
-SQL Database-v5
How do I fix this? Is there a form that the file needs to be in for the current version of Bluemix?

Add quotes around SQL Database-v5 to have it treated as a single string even though there is a space in it. Spaces matter in YAML.
...
services:
- "SQL Database-v5"
The documentation has more information and examples.

Related

Unable to view the contents of file in ansible managed nodes

I'm trying to view the contents of a file from managed node and control node, here I see the syntax works fine for localhost (172.17.254.200) but not for the remote hosts. Below is the task I have written using lookup / query plugin, can you please suggest the fix:
---
- name: Report Test
hosts: all
roles:
- patching
tasks:
- name: Display the Pre and Post check Differences
debug:
msg: "{{ query('file', '/tmp/check/{{ inventory_hostname }}_Comparison') }}"
Below is the output
TASK [patching : Display the Pre and Post check Differences] ***********************************************************************************************************
ok: [172.17.254.200] =>
msg:
- |-
free_m - YES
sysctl_all - YES
uptime - YES
[WARNING]: Unable to find '/tmp/check/172.17.254.207_Comparison' in expected paths (use -vvvvv to see paths)
fatal: [172.17.254.207]: FAILED! =>
msg: 'An unhandled exception occurred while running the lookup plugin ''file''. Error was a <class ''ansible.errors.AnsibleError''>, original message: could not locate file in lookup: /tmp/check/172.17.254.207_Comparison'
[WARNING]: Unable to find '/tmp/check/172.17.254.208_Comparison' in expected paths (use -vvvvv to see paths)
fatal: [172.17.254.208]: FAILED! =>
msg: 'An unhandled exception occurred while running the lookup plugin ''file''. Error was a <class ''ansible.errors.AnsibleError''>, original message: could not locate file in lookup: /tmp/check/172.17.254.208_Comparison'
Lookups are executed on Ansible controller (as pointed out by #Vladimir Botka). If you just want to view the contents of a file on remote hosts, you can cat the file through ansible and debug the stdout_lines.
- command: "cat /tmp/check/{{ inventory_hostname }}_Comparison"
register: file_cat
changed_when: false
- debug:
var: file_cat.stdout_lines
lookup and query "execute and are evaluated on the Ansible control machine."
Use slurp. Quoting:
This module returns an ‘in memory’ base64 encoded version of the file, take into account that this will require at least twice the RAM as the original file size.
For larger files use fetch. Quoting:
It is used for fetching files from remote machines and storing them locally in a file tree, organized by hostname.

Invalid characters were found in group names but not replaced ansible k8s

My k8s.yaml inventory file is:
plugin: k8s
connections:
- kubeconfig: '/Users/user1/Documents/Learning/ansible/kubeconfig.test.yaml'
context: 'user1#testeks.us-east-1.eksctl.io'
ansible playbook:
test_new.yml
- hosts: localhost
tasks:
- name: Create a k8s namespace
k8s:
name: testing3
api_version: v1
kind: Namespace
state: present
Looks like the ansibleplaybook command is not picking up the inventory k8s.yaml.Also I am not sure why I am getting Warning invalid characters {'-' in group name warnings.
Please let me know if the above inventory file and ansible playbook files look good or are there anything I am missing?
ansible-playbook -vvvv -i k8s.yaml -vvv ./test_new.yml
No config file found; using defaults
setting up inventory plugins
host_list declined parsing /Users/user1/Documents/Learning/ansible/k8s.yaml as it did not pass its verify_file() method
script declined parsing /Users/user1/Documents/Learning/ansible/k8s.yaml as it did not pass its verify_file() method
Not replacing invalid character(s) "{'-', '9'}" in group name (909676E2B4F81625BF5994625D3353C9-yl4-us-east-1-eks-amazonaws-com)
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
Not replacing invalid character(s) "{'-'}" in group name (namespace_add-ons)
Not replacing invalid character(s) "{'-'}" in group name (namespace_add-ons_pods)
Not replacing invalid character(s) "{'.', '/', '-'}" in group name (label_app.kubernetes.io/instance_aws-cluster-autoscaler)
I'm not sure where you got that you need the Kubernetes parameters specified in your inventory file. If you look at the k8s module documentation it says that kubeconfig and context are specified in the playbook or as environment variables.
Your inventory should look something like this:
all:
hosts:
host.where.can.access.the.kubeapiserver.com:
Then your playbook:
- name: Create a k8s namespace
k8s:
name: testing3
api_version: v1
kind: Namespace
state: present
kubeconfig: '/Users/user1/Documents/Learning/ansible/kubeconfig.test.yaml' 👈 this can replaced by the K8S_AUTH_KUBECONFIG env variable
context: 'user1#testeks.us-east-1.eksctl.io' 👈 this can replaced by the K8S_AUTH_CONTEXT env variable
Based on the formatting of your post, it looks like your inventory file contains improper syntax. It should look like this:
plugin: k8s
connections:
- kubeconfig: '/Users/user1/Documents/Learning/ansible/kubeconfig.test.yaml'
context: 'user1#testeks.us-east-1.eksctl.io'
Remember that spaces are important.
For deprecation warnings, be sure to read up on these issues:
https://github.com/ansible/ansible/issues/56930
https://github.com/kubernetes-sigs/kubespray/issues/4830
Usage of hyphens in inventory group names was deprecated in Ansible 2.8 due to Python parser errors when using dot syntax. Auto-transformation can be disabled by adding force_valid_group_names = never to your Ansible config file. Similarly, deprecation warnings can be suppressed by adding deprecation_warnings = False though this is not recommended.

Is there any placeholder notation in mta.yaml that removes spaces from the CF org name parameter?

We are using mta to structure our application and deploying it using the SAP Cloud SDK Pipeline and Transport Management landscape.
In the mta.yaml, we are referencing the org (organization) parameter value using the placeholder notation ${org}.
The issue is that the org name contains spaces between the characters (viz. Sample Org Name) and that is causing error during the application deployment to Cloud Foundry.
We do not want to rename the org name.
Is there any other placeholder notation that removes the spaces between the characters?
We have observed that ${default-host} removes the spaces from the organization name but its scope is limited to only modules and not resources.
We need the substitution variable in the resources scope.
Appreciate if someone can help us here to resolve the issue.
Please find snippet of the mta.yaml and the error message.
resources:
- name: uaa_test_app
parameters:
path: ./xs-security.json
service-plan: application
service: xsuaa
config:
xsappname: 'test-app-${org}-${space}'
type: org.cloudfoundry.managed-service
Error Message:
Service operation failed: Controller operation failed: 502 Updating service "uaa_test_app" failed: Bad Gateway: Service broker error: Service broker xsuaa failed with: org.springframework.cloud.servicebroker.exception.ServiceBrokerException: Error updating application null (Error parsing xs-security.json data: Inconsistent xs-security.json: Invalid xsappname "Test-App-Sample Org Name-test": May only include characters 'a'-'z', 'A'-'Z', '0'-'9', '_', '-', '', and '/'.)

How to specify Watson Language Translator service as declared service

I have a small issue.. I am trying to use the 'deploy to bluemix' button with a node-red application. That is working fine. I also want to deploy two services automatically with this button. For one service it is working, the other will not deploy... This is my manifest file:
applications:
- path: .
memory: 512M
instances: 1
name: LanguageTranslatorLT
host: LanguageTranslatorLT
disk_quota: 1024M
- services:
- LanguageTranslatorLT-cloudantNoSQLDB
- language-translator-service
name: language-translator-demo
env:
NODE_RED_STORAGE_NAME: LanguageTranslatorLT-cloudantNoSQLDB
declared-services:
LanguageTranslatorLT-cloudantNoSQLDB:
label: cloudantNoSQLDB
plan: Lite
language-translator-service:
label: language-translator
plan: advanced
The language-translator-service, will not deploy. when I use the button, I get this error:
Binding service LanguageTranslatorLT-cloudantNoSQLDB to app LanguageTranslatorHB-1485255424408-hansb-1633 in org xxx / space dev2 as xxx...
OK
FAILED
Could not find service LanguageTranslatorLT-LanguageTranslator to bind to LanguageTranslatorHB-1485255424408-hansb-1633
Finished: FAILED
I guess it is something in the naming of the service, but I cannot find it. Maybe someone else knows?
When running cf marketplace the Language Translator service is listed as:
language_translator (with underscore instead of dash) with standard, advanced and premium plans.
In your manifest file you need to correct the section to:
language-translator-service:
label: language_translator
plan: advanced
I think that for language translator the label you need to use is language_translator. IE.
declared-services:
LanguageTranslatorLT-cloudantNoSQLDB:
label: cloudantNoSQLDB
plan: Lite
language-translator-service:
label: language_translator
plan: advanced
You can tell what services are available to you by running the command
cf marketplace
as described in the documentation for creating your own deploy button. - https://console.ng.bluemix.net/docs/develop/deploy_button.html

Error reading manifest file in bluemix deploy

I'm having a hard time to deploy this standard ecommerce project on Bluemix:
https://github.com/zallaricardo/ecommerce-devops
I've chosen to do it with git repository and automatic deploy through the Bluemix pipeline service. After successfully building and fixing a lot of misconfigurations, the root challenge seems to be write a correct version of the manifest.yml file for the project.
Without the manifest.yml file, the log shows the following error:
Downloading artifacts...DOWNLOAD SUCCESSFUL
Target: https://api.ng.bluemix.net
Updating app loja-virtual-devops in org pfc-devops / space Dev as [email account]...
OK
Uploading loja-virtual-devops...
Uploading app files from: /home/pipeline/d38f0184-33da-44da-ba16-4671b491988a
Uploading 384.1M, 1679 files
228.5M uploaded...
Done uploading
OK
Stopping app loja-virtual-devops in org pfc-devops / space Dev as [email account]...
OK
Starting app loja-virtual-devops in org pfc-devops / space Dev as[email account]...
-----> Downloaded app package (452M)
-----> Downloaded app buildpack cache (4.0K)
Staging failed: An application could not be detected by any available buildpack
FAILED
NoAppDetectedError
TIP: Buildpacks are detected when the "cf push" is executed from within the directory that contains the app source code.
Use 'cf buildpacks' to see a list of supported buildpacks.
Use 'cf logs loja-virtual-devops --recent' for more in depth log information.
And with the version of manifest which I believe * - I'm new on this manifests stuff* - to be ok and sufficient, the log shows:
Downloading artifacts...DOWNLOAD SUCCESSFUL
Target: https://api.ng.bluemix.net
FAILED
Error reading manifest file:
yaml: unmarshal errors:
line 2: cannot unmarshal !!seq into map[interface {}]interface {}
The manifest.yml file is currently written as follows:
---
- name: loja-virtual-devops
memory: 512M
buildpack: https://github.com/cloudfoundry/java-buildpack
domain: mybluemix.net
I'll sincerely appreciate any hint about how to fix the manifest for this application or another way to successfully deploy the project through Bluemix.
Try including the applications heading in your manifest.yml file.
example:
applications:
- name: appname
host: app_hostname
buildpack: java_buildpack
instances: 2
memory: 512M
disk_quota: 512M
path: .