Skip to content

Conversation

@PierreR
Copy link
Collaborator

@PierreR PierreR commented May 18, 2018

First step for #245

Copy link
Collaborator Author

@PierreR PierreR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be useful, it at least needs to prevent throwing an error on such erb call:
auth.ldap.bindpw: <%= @ldap_pwd.unwrap %>
This does not work:

modified   ruby/hrubyerb.rb
@@ -48,6 +48,11 @@ class Scope
         vl('~g~e~t_h~a~s~h~')
     end
 
+    def function_unwrap(args)
+        put '~u~n~w_r~a~p~'
+        args
+    end
+
     def function_to_yaml(args)
         args.to_yaml
     end
@@ -117,4 +122,3 @@ class Controller
         nerb.result(binding.get_binding)
     end
 end
-

Any idea ?

DTScalar -> datatypeMatch (DTVariant (DTInteger Nothing Nothing :| [DTString Nothing Nothing, DTBoolean])) v
DTData -> datatypeMatch (DTVariant (DTScalar :| [DTArray DTData 0 Nothing, DTHash DTScalar DTData 0 Nothing])) v
DTOptional sdt -> datatypeMatch (DTVariant (DTUndef :| [sdt])) v
DTSensitive sdt -> datatypeMatch (DTVariant (DTUndef :| [sdt])) v
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bartavelle Is this alright ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this is alright. If you want it to work "right", you should create a new datatype for the interpreter, and it should only match that.

It seems impossible to validate it properly without adding special logic. Indeed, it says:

The Sensitive type is parameterized, but the parameterized type (the type of the value it contains) only retains the basic type, but sensitive information about the length or details about the contained data value can be leaked.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can write a ruby to haskell binding so that it can call unwrap.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do I write such binding ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably in the Puppet.Runner.Erb module. Look at how the varlookup function is exported to the ruby runtime

@PierreR PierreR force-pushed the master branch 2 times, most recently from f7eb243 to e89c7b6 Compare February 20, 2019 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants