Python 3.3.3 (default, Jan 11 2014, 05:48:01)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> template = pkg_resources.resource_string(__name__,
"default_apache.tmpl")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 891, in
resource_string
self, resource_name
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1292, in
get_resource_string
return self._get(self._fn(self.module_path, resource_name))
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1370, in
_get
"Can't perform this operation for loaders without 'get_data()'"
NotImplementedError: Can't perform this operation for loaders without
'get_data()'
Seems to work fine in python2.
https://codereview.appspot.com/56140043/diff/1/tests/10_deploy_test.py#newcode29
tests/10_deploy_test.py:29: configuration = {'vhost_https_template' :
encodedTemplate.decode('ascii')}
You are right I can convert (encode) the template with utf-8 but all the
character set of base65 can be represented in ascii, so I will keep that
on the decode.
Thanks for the review Benjamin.
https:/ /codereview. appspot. com/56140043/ diff/1/ tests/10_ deploy_ test.py deploy_ test.py (right):
File tests/10_
https:/ /codereview. appspot. com/56140043/ diff/1/ tests/10_ deploy_ test.py# newcode19 deploy_ test.py: 19: #d.add('apache2', units=units)
tests/10_
Thanks for the comment, removed the comments.
https:/ /codereview. appspot. com/56140043/ diff/1/ tests/10_ deploy_ test.py# newcode24 deploy_ test.py: 24: template_path = os.path.join(path, apache. tmpl')
tests/10_
'default_
I was not aware of pkg_resources. I get an error when I try that code in
python3.
Python 3.3.3 (default, Jan 11 2014, 05:48:01) resource_ string( __name_ _, apache. tmpl") python3/ dist-packages/ pkg_resources. py", line 891, in python3/ dist-packages/ pkg_resources. py", line 1292, in self._fn( self.module_ path, resource_name)) python3/ dist-packages/ pkg_resources. py", line 1370, in rror: Can't perform this operation for loaders without
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> template = pkg_resources.
"default_
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/
resource_string
self, resource_name
File "/usr/lib/
get_resource_string
return self._get(
File "/usr/lib/
_get
"Can't perform this operation for loaders without 'get_data()'"
NotImplementedE
'get_data()'
Seems to work fine in python2.
https:/ /codereview. appspot. com/56140043/ diff/1/ tests/10_ deploy_ test.py# newcode29 deploy_ test.py: 29: configuration = {'vhost_ https_template' : .decode( 'ascii' )}
tests/10_
encodedTemplate
You are right I can convert (encode) the template with utf-8 but all the
character set of base65 can be represented in ascii, so I will keep that
on the decode.
https:/ /codereview. appspot. com/56140043/ diff/1/ tests/10_ deploy_ test.py# newcode65 deploy_ test.py: 65: print('Private address of the apache2 'private- address' ])
tests/10_
relation ', relation[
I really like having the print there for manual testing. It does not
create too much extra logging I would prefer to keep it.
https:/ /codereview. appspot. com/56140043/