Ruby on Rails Thursday, May 3, 2018

Good day, 
I am new to Ruby but it is used for types and providers in puppet.
I am attempting to fix a module that isnt working.

    def exists?
        self.class.send_log(:info, "call exists?")
        begin
            myreturnvalue =   powershell([ "import-module activedirectory;","Get-ADGroup -Filter {(name -eq \"#{@resource[:name]}\")}"])
            self.class.send_log(:debug, "Get-ADGroup: The return value is : #{myreturnvalue} ")

            if myreturnvalue == ""
                false
            else
                true
            end
        rescue Puppet::ExecutionFailure => e
            self.class.send_log(:err, "Error In Commands: " )
            false
        end
    end

That is the method used to check if exists.

It returns a group, then the module has 
def name
        "\"" + @resource[:name].to_s + "\""
    end

    def path
        "\"" + @resource[:path].to_s + "\""
    end

    def desc
       "\"" + @resource[:desc].to_s + "\""
    end
    def desc=(value)
    end

    def group_scope
        "\"" + @resource[:group_scope].to_s + "\""
    end
    def group_scope=(value)
    end

    def group_category
        "\"#{@resource[:group_category]}\""
    end
    def group_category=(value)
    end

When this is run, ever time it makes "changes" that arent changes really.
desc changed '"Windows AD Group Managed by Puppet"' to 'Windows AD Group Managed by Puppet'
or 
group_scope changed "\"DomainLocal\"" to :DomainLocal
or
group_category changed '"Security"' to 'Security'

I assume in the define it is appending "" on description that really isnt there and then compare see it is different.

Any help, documentation or guidance would be greatly appreciated. 

Thank you

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f29fb01d-471f-4ab9-84b9-5efb7431096c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment