Skip to content
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.

api method resource_attribute() not correctly handling attributes with string interpolation #629

Open
jdannenberg opened this issue May 17, 2017 · 0 comments
Labels

Comments

@jdannenberg
Copy link

jdannenberg commented May 17, 2017

Given this resource:

execute "Extract Maven #{version} to #{version}" do
      command "tar xzf #{maven_file} --strip-components=1 -C #{targetDirectory}"
      creates "#{targetDirectory}/bin"
    end

resource_attributes(execute_resource) returns {:name=>"Extract Maven ", "command"=>"tar xzf ", "creates"=>"/bin"}.

The XML at this point looks like this:

<command>
    <ident value="command">
      <pos line="43" column="6"/>
    </ident>
    <args_add_block value="false">
      <args_add>
	<args_new/>
	<string_literal>
	  <string_add>
	    <string_add>
	      <string_add>
		<string_add>
		  <string_content/>
		  <tstring_content value="tar xzf ">
		    <pos line="43" column="15"/>
		  </tstring_content>
		</string_add>
		<string_embexpr>
		  <stmts_add>
		    <stmts_new/>
		    <var_ref>
		      <ident value="maven_file">
			<pos line="43" column="25"/>
		      </ident>
		    </var_ref>
		  </stmts_add>
		</string_embexpr>
	      </string_add>
	      <tstring_content value=" --strip-components=1 -C ">
		<pos line="43" column="36"/>
	      </tstring_content>
	    </string_add>
	    <string_embexpr>
	      <stmts_add>
		<stmts_new/>
		<var_ref>
		  <ident value="targetDirectory">
		    <pos line="43" column="63"/>
		  </ident>
		</var_ref>
	      </stmts_add>
	    </string_embexpr>
	  </string_add>
	</string_literal>
      </args_add>
    </args_add_block>
  </command>
</stmts_add>
<command>

tested for foodcritic 11.0

@tas50 tas50 added the Bug label Nov 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants