basho / node_package

RPM/Debian/FreeBSD/SmartOS/Solaris/OSX packaging templates for Erlang Nodes
Apache License 2.0
89 stars 63 forks source link

Su invocation is not escaped properly for TS work [JIRA: TOOLS-167] #192

Open macintux opened 8 years ago

macintux commented 8 years ago

When using TS packages, riak-admin is crippled for defining bucket types because of the need to use su to the riak user.

As seen below from sh -x, the JSON is not wrapped properly, and the shell complains.

exec su - riak -c '/usr/sbin/riak-admin bucket-type create testone \{\"props\":\{\"table_def\":\"CREATE TABLE testone (field1 varchar not null, field2 varchar not null, time timestamp not null, PRIMARY KEY((field1, field2, quantum(time, 15, s)), field1, field2, time))\"\}\}'
macintux commented 8 years ago

Valid workaround: su to the riak user before executing the riak-admin command.

macintux commented 8 years ago

(discovered by @binarytemple)

Basho-JIRA commented 8 years ago

A PR was submitted that should resolve this- see https://github.com/basho/node_package/pull/193

_[posted via JIRA by Greg Cymbalski]_

Basho-JIRA commented 8 years ago

Packages that demonstrate this change are up at s3://builds.basho.com/nightlies/riak-ts/1/centos-6/

_[posted via JIRA by Greg Cymbalski]_

Basho-JIRA commented 8 years ago

Fix looks good to me:

[centos@ip-172-31-27-220 ~]$ sudo /usr/sbin/riak-admin bucket-type create testone '{"props":{"table_def":"CREATE TABLE testone (field1 varchar not null, field2 varchar not null, time timestamp not null, PRIMARY KEY((field1, field2, quantum(time, 15, s)), field1, field2, time))"}}' testone created

WARNING: After activating testone, nodes in this cluster can no longer be downgraded to a version of Riak prior to 2.0

_[posted via JIRA by Paul Hagan]_

kesslerm commented 8 years ago

As reported by a Solaris user on 2.0.7, the fix broke execution on Solaris10:

/opt/riak/sbin/riak: syntax error at line 242:ESCAPED_ARGS=$' unexpected`