[Container-tools] hacking on atomicapp-run

Aaron Weitekamp aweiteka at redhat.com
Wed May 6 04:07:54 UTC 2015


Vasek, Langdon and I hit a few issues trying out atomicapp-run[1]
- needed empty dict in answers.conf: "general: {}" (maybe it just doesn't handle null value?)
- provider was kubernetes even when answerfile was "docker" and default[2] was hacked with hard-coded "docker". Output[3]
- I got further with a custom kubernetes application but it failed on install[4]. I was able to install when entering the container[5] but hit this run error[6]

[1] https://github.com/vpavlin/atomicapp-run

[2] https://github.com/vpavlin/atomicapp-run/blob/master/containerapp/constants.py#L13

[3]
$ cat /etc/wp-app/answers.conf 
general: {}
provider: docker
$ sudo atomic install vpavlin/wp-app
docker run --rm -it --privileged -v /run:/run -v ${DATADIR}:/atomicapp -v /:/host -v ${CONFDIR}/answers.conf:/application-entity/answers.conf -e IMAGE=vpavlin/wp-app -e NAME=wp-app --name wp-app vpavlin/wp-app containerapp -v install --path /atomicapp /application-entity
2015-05-05 15:46:10,633 - containerapp.install - INFO - App path is /application-entity, will be populated to /atomicapp
2015-05-05 15:46:10,693 - containerapp.params - DEBUG - Setting app id to wordpress-app
2015-05-05 15:46:10,694 - containerapp.utils - DEBUG - Setting path to /application-entity
2015-05-05 15:46:10,694 - containerapp.params - DEBUG - Path to answers file given, loading /application-entity/answers.conf
2015-05-05 15:46:10,696 - containerapp.install - INFO - Copying content of directory /application-entity to /atomicapp
2015-05-05 15:46:10,696 - containerapp.install - INFO - Copying app wp-app
2015-05-05 15:46:10,731 - containerapp.utils - DEBUG - No artifacts for mariadb-app
2015-05-05 15:46:10,731 - containerapp.utils - DEBUG - Provider: docker
2015-05-05 15:46:10,731 - containerapp.utils - DEBUG - Artifact file://graph/docker/label_run: OK
2015-05-05 15:46:10,732 - containerapp.utils - DEBUG - Provider: openshift
2015-05-05 15:46:10,732 - containerapp.utils - DEBUG - Artifact file://graph/kubernetes/wordpress-pod.json: OK
2015-05-05 15:46:10,733 - containerapp.utils - DEBUG - Artifact file://graph/kubernetes/wordpress-service.json: OK
2015-05-05 15:46:10,733 - containerapp.utils - INFO - Artifacts for wordpress-app present for these providers: docker, openshift
2015-05-05 15:46:10,734 - containerapp.install - INFO - Component data exist in /atomicapp/graph/wp-app, skipping population...
2015-05-05 15:46:10,734 - containerapp.utils - DEBUG - {u'source': u'docker://vpavlin/mariadb-app'}
2015-05-05 15:46:10,734 - containerapp.install - INFO - Component mariadb-app is external dependency
2015-05-05 15:46:10,735 - containerapp.install - DEBUG - Component path: /atomicapp/external/mariadb-app
2015-05-05 15:46:10,735 - containerapp.install - INFO - Pulling vpavlin/mariadb-app
2015-05-05 15:46:10,735 - containerapp.install - INFO - App name is vpavlin/mariadb-app, will be populated to /atomicapp/external/mariadb-app
2015-05-05 15:46:10,736 - containerapp.params - DEBUG - Path to answers file given, loading /application-entity/answers.conf
Trying to pull repository registry.access.redhat.com/vpavlin/mariadb-app ... not found
Trying to pull repository docker.io/vpavlin/mariadb-app ...
d91c51dd843b: Download complete 
48ecf305d2cf: Download complete 
93be8052dfb8: Download complete 
d364b63640ba: Download complete 
191c9f2e2f36: Download complete 
d2651828afb8: Download complete 
2899b24724a5: Download complete 
50f29c5875bf: Download complete 
86943f2fd311: Download complete 
f576de234d78: Download complete 
0d01d6974ff9: Download complete 
c48b7d2e2a46: Download complete 
4d573f10028e: Download complete 
ba19aaf75e96: Download complete 
05c735695902: Download complete 
73a89e479333: Download complete 
5166ceec1dcf: Download complete 
Status: Image is up to date for docker.io/vpavlin/mariadb-app:latest
9abea96c54bd39c4e8cf33392a8b6b42e442c58e10c98e8691bbd9a92b921047
2015-05-05 15:46:18,581 - containerapp.utils - INFO - Using temporary directory /tmp/appent-mariadb-app3Vz3AS
2015-05-05 15:46:18,582 - containerapp.install - DEBUG - ['docker', 'cp', u'mariadb-app:/application-entity', u'/tmp/appent-mariadb-app3Vz3AS']
2015-05-05 15:46:19,149 - containerapp.install - DEBUG - Application entity data copied to /tmp/appent-mariadb-app3Vz3AS
mariadb-app
2015-05-05 15:46:19,285 - containerapp.install - DEBUG - nulecule path for pulled image: /tmp/appent-mariadb-app3Vz3AS/application-entity/nulecule
2015-05-05 15:46:19,299 - containerapp.params - DEBUG - Setting app id to mariadb-app
2015-05-05 15:46:19,299 - containerapp.install - DEBUG - App ID: mariadb-app
2015-05-05 15:46:19,299 - containerapp.install - INFO - Copying app mariadb-app
2015-05-05 15:46:19,303 - containerapp.utils - DEBUG - Provider: docker
2015-05-05 15:46:19,303 - containerapp.utils - DEBUG - Artifact file://graph/docker/label_run: OK
2015-05-05 15:46:19,303 - containerapp.utils - DEBUG - Provider: openshift
2015-05-05 15:46:19,303 - containerapp.utils - DEBUG - Artifact file://graph/k8s/mariadb-pod.json: OK
2015-05-05 15:46:19,303 - containerapp.utils - DEBUG - Artifact file://graph/k8s/mariadb-service.json: OK
2015-05-05 15:46:19,303 - containerapp.utils - INFO - Artifacts for mariadb-app present for these providers: docker, openshift
2015-05-05 15:46:19,304 - containerapp.install - INFO - Component installed into /atomicapp/external/mariadb-app
2015-05-05 15:46:19,304 - containerapp.utils - DEBUG - {u'artifacts': {u'docker': [u'file://graph/docker/label_run'], u'openshift': [u'file://graph/kubernetes/wordpress-pod.json', u'file://graph/kubernetes/wordpress-service.json']}, u'params': {u'image': {u'default': u'vpavlin/wordpress', u'description': u'The image which containing the Wordpress itself'}, u'name': {u'default': u'wordpress', u'description': u"Name given to a container when it's run"}}}
2015-05-05 15:46:19,304 - containerapp.install - DEBUG - Component wordpress-app is part of the app
[cloud-user at aweiteka-atomic-cluster-82e95893-f91a-4dd7-b026-c67666d08bb4 ~]$ sudo atomic run vpavlin/wp-app
docker run -it --privileged -v ${DATADIR}:/atomicapp -v /run:/run -v /:/host -v ${CONFDIR}/answers.conf:/application-entity/answers.conf --name wp-app -e NAME=wp-app -e IMAGE=vpavlin/wp-app vpavlin/wp-app containerapp -v run /atomicapp
2015-05-05 15:46:52,472 - containerapp.run - DEBUG - Path to code /usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp
2015-05-05 15:46:52,506 - containerapp.params - DEBUG - Setting app id to wordpress-app
2015-05-05 15:46:52,506 - containerapp.params - DEBUG - Path to answers file given, loading /application-entity/answers.conf
2015-05-05 15:46:52,508 - containerapp.utils - DEBUG - No artifacts for mariadb-app
2015-05-05 15:46:52,508 - containerapp.utils - DEBUG - Provider: docker
2015-05-05 15:46:52,508 - containerapp.utils - DEBUG - Artifact file://graph/docker/label_run: OK
2015-05-05 15:46:52,509 - containerapp.utils - DEBUG - Provider: openshift
2015-05-05 15:46:52,509 - containerapp.utils - DEBUG - Artifact file://graph/kubernetes/wordpress-pod.json: OK
2015-05-05 15:46:52,509 - containerapp.utils - DEBUG - Artifact file://graph/kubernetes/wordpress-service.json: OK
2015-05-05 15:46:52,509 - containerapp.utils - INFO - Artifacts for wordpress-app present for these providers: docker, openshift
2015-05-05 15:46:52,509 - containerapp.utils - DEBUG - {u'source': u'docker://vpavlin/mariadb-app'}
2015-05-05 15:46:52,510 - containerapp.run - DEBUG - Path to code /usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp
2015-05-05 15:46:52,524 - containerapp.params - DEBUG - Setting app id to mariadb-app
2015-05-05 15:46:52,524 - containerapp.params - DEBUG - Path to answers file given, loading /application-entity/answers.conf
2015-05-05 15:46:52,525 - containerapp.utils - DEBUG - Provider: docker
2015-05-05 15:46:52,526 - containerapp.utils - DEBUG - Artifact file://graph/docker/label_run: OK
2015-05-05 15:46:52,526 - containerapp.utils - DEBUG - Provider: openshift
2015-05-05 15:46:52,526 - containerapp.utils - DEBUG - Artifact file://graph/k8s/mariadb-pod.json: OK
2015-05-05 15:46:52,526 - containerapp.utils - DEBUG - Artifact file://graph/k8s/mariadb-service.json: OK
2015-05-05 15:46:52,526 - containerapp.utils - INFO - Artifacts for mariadb-app present for these providers: docker, openshift
2015-05-05 15:46:52,526 - containerapp.utils - DEBUG - {u'artifacts': {u'docker': [u'file://graph/docker/label_run'], u'openshift': [u'file://graph/k8s/mariadb-pod.json', u'file://graph/k8s/mariadb-service.json']}, u'params': {u'image': {u'default': u'vpavlin/mariadb', u'description': u'The image which containing the Wordpress itself'}, u'name': {u'default': u'mariadb', u'description': u"Name given to a container when it's run"}}}
2015-05-05 15:46:52,526 - containerapp.run - DEBUG - Processing component mariadb-app
Traceback (most recent call last):
  File "/usr/bin/containerapp", line 9, in <module>
    load_entry_point('containerapp==0.1', 'console_scripts', 'containerapp')()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/cli/main.py", line 100, in main
    cli.run()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/cli/main.py", line 82, in run
    args.func(args)
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/cli/main.py", line 32, in cli_run
    ae.run()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/run.py", line 150, in run
    self._dispatchGraph()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/run.py", line 73, in _dispatchGraph
    ret = component_run.run()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/run.py", line 150, in run
    self._dispatchGraph()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/run.py", line 77, in _dispatchGraph
    self._processComponent(component, graph_item)
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/run.py", line 115, in _processComponent
    raise Exception("Data for provider \"%s\" are not part of this app" % self.params.provider)
Exception: Data for provider "kubernetes" are not part of this app


[4] Install from outside container
$ sudo atomic install helloapache
docker run --rm -it --privileged -v /run:/run -v ${DATADIR}:/atomicapp -v /:/host -v ${CONFDIR}/answers.conf:/application-entity/answers.conf -e IMAGE=helloapache -e NAME=helloapache --name helloapache helloapache containerapp -v install --path /atomicapp /application-entity
2015-05-05 23:48:01,105 - containerapp.install - INFO - App path is /application-entity, will be populated to /atomicapp
2015-05-05 23:48:01,189 - containerapp.params - DEBUG - Setting app id to helloapache-app
2015-05-05 23:48:01,189 - containerapp.utils - DEBUG - Setting path to /application-entity
2015-05-05 23:48:01,189 - containerapp.params - DEBUG - Path to answers file given, loading /application-entity/answers.conf
Traceback (most recent call last):
  File "/usr/bin/containerapp", line 9, in <module>
    load_entry_point('containerapp==0.1', 'console_scripts', 'containerapp')()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/cli/main.py", line 100, in main
    cli.run()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/cli/main.py", line 82, in run
    args.func(args)
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/cli/main.py", line 18, in cli_install
    install.install()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/install.py", line 75, in install
    if not self.params.loadAnswers(self.answers_file):
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/params.py", line 103, in loadAnswers
    data = anymarkup.parse_file(data)
  File "build/bdist.linux-x86_64/egg/anymarkup/__init__.py", line 103, in parse_file
anymarkup.AnyMarkupError: AnyMarkupError: caught <type 'exceptions.IOError'>: [Errno 21] Is a directory: '/application-entity/answers.conf'




[5] install from inside container

bash-4.3# containerapp -v install --path /atomicapp /application-entity
2015-05-06 00:06:45,476 - containerapp.install - INFO - App path is /application-entity, will be populated to /atomicapp
2015-05-06 00:06:45,487 - containerapp.params - DEBUG - Setting app id to helloapache-app
2015-05-06 00:06:45,487 - containerapp.utils - DEBUG - Setting path to /application-entity
2015-05-06 00:06:45,487 - containerapp.params - DEBUG - Path to answers file given, loading /application-entity/answers.conf
2015-05-06 00:06:45,489 - containerapp.install - INFO - Copying content of directory /application-entity to /atomicapp
2015-05-06 00:06:45,489 - containerapp.install - INFO - Copying app helloapache
2015-05-06 00:06:45,490 - containerapp.utils - DEBUG - Provider: kubernetes
2015-05-06 00:06:45,490 - containerapp.utils - DEBUG - Artifact file://graph/k8s/hello-apache-pod.json: OK
2015-05-06 00:06:45,490 - containerapp.utils - INFO - Artifacts for helloapache-app present for these providers: kubernetes
2015-05-06 00:06:45,490 - containerapp.install - INFO - Component data exist in /atomicapp/graph/helloapache, skipping population...
2015-05-06 00:06:45,490 - containerapp.utils - DEBUG - {u'artifacts': {u'kubernetes': [u'file://graph/k8s/hello-apache-pod.json']}, u'params': {u'image': {u'default': u'fedora/apache', u'description': u'The image which containing the Wordpress itself'}, u'name': {u'default': u'helloapache', u'description': u"Name given to a container when it's run"}}}
2015-05-06 00:06:45,491 - containerapp.install - DEBUG - Component helloapache-app is part of the app



[6] Run from inside container
bash-4.3# containerapp -v run /atomicapp --ask   
2015-05-05 23:58:37,435 - containerapp.run - DEBUG - Path to code /usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp
2015-05-05 23:58:37,446 - containerapp.params - DEBUG - Setting app id to helloapache-app
2015-05-05 23:58:37,446 - containerapp.params - DEBUG - Path to answers file given, loading /application-entity/answers.conf
2015-05-05 23:58:37,448 - containerapp.utils - DEBUG - Provider: kubernetes
2015-05-05 23:58:37,448 - containerapp.utils - DEBUG - Artifact file://graph/k8s/hello-apache-pod.json: OK
2015-05-05 23:58:37,448 - containerapp.utils - INFO - Artifacts for helloapache-app present for these providers: kubernetes
2015-05-05 23:58:37,448 - containerapp.utils - DEBUG - {u'artifacts': {u'kubernetes': [u'file://graph/k8s/hello-apache-pod.json']}, u'params': {u'image': {u'default': u'fedora/apache', u'description': u'The image which containing the web server'}, u'name': {u'default': u'helloapache', u'description': u"Name given to a container when it's run"}}}
2015-05-05 23:58:37,448 - containerapp.run - DEBUG - Processing component helloapache-app
2015-05-05 23:58:37,453 - containerapp.utils - INFO - Using temporary directory /tmp/appent-helloapache-appYWEhDQ
2015-05-05 23:58:37,453 - containerapp.run - DEBUG - Templating artifact /atomicapp/graph/k8s/hello-apache-pod.json
2015-05-05 23:58:37,453 - containerapp.params - DEBUG - Ask for image: The image which containing the web server
image (The image which containing the web server, default: fedora/apache): 
2015-05-05 23:58:39,127 - containerapp.params - DEBUG - Ask for name: Name given to a container when it's run
name (Name given to a container when it's run, default: helloapache): 
2015-05-05 23:58:40,227 - containerapp.run - DEBUG - Config: {u'image': u'fedora/apache', u'name': u'helloapache'} 
2015-05-05 23:58:40,228 - containerapp.run - DEBUG - {u'image': u'fedora/apache', u'name': u'helloapache'}
2015-05-05 23:58:40,278 - containerapp.run - DEBUG - Writing artifact to /tmp/appent-helloapache-appYWEhDQ/helloapache-app/graph/k8s/hello-apache-pod.json
2015-05-05 23:58:40,279 - containerapp.run - INFO - Using provider kubernetes for component helloapache-app
Traceback (most recent call last):
  File "/usr/bin/containerapp", line 9, in <module>
    load_entry_point('containerapp==0.1', 'console_scripts', 'containerapp')()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/cli/main.py", line 100, in main
    cli.run()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/cli/main.py", line 82, in run
    args.func(args)
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/cli/main.py", line 32, in cli_run
    ae.run()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/run.py", line 150, in run
    self._dispatchGraph()
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/run.py", line 77, in _dispatchGraph
    self._processComponent(component, graph_item)
  File "/usr/lib/python2.7/site-packages/containerapp-0.1-py2.7.egg/containerapp/run.py", line 138, in _processComponent
    provider.init(self.params.getValues(component), artifact_provider_list, dst_dir, self.dryrun, logger)
AttributeError: 'NoneType' object has no attribute 'init'




More information about the Container-tools mailing list