Custom Search

Thursday, May 21, 2015

puppet ruby rspec: gsub example



1)
#vim  exampl2.erb

##9 spaces i given. gsub removes first 8 spaces from lines which start with space.

print "         HelloSaju".gsub(/^ {8}/, '')

print "\n"



2)
#vim example1.erb

print <<-api b="">.gsub(/^ {8}/, '')
        [DEFAULTS]
        ifmap_server_ip=10.1.1.1
        ifmap_server_port=8443
        ifmap_username=api-server
        ifmap_password=api-server

        [SECURITY]
        use_certs=false
        keyfile=/etc/contrail/ssl/private_keys/apiserver_key.pem
        certfile=/etc/contrail/ssl/certs/apiserver.pem
        ca_certs=/etc/contrail/ssl/certs/ca.pem

        [KEYSTONE]
        auth_host=10.1.1.2
        auth_protocol=http
        auth_port=35357
        admin_user=admin
        admin_password=admin_password
        admin_token=admin_token
        admin_tenant_name=openstack
      API


print "\n"





No comments:

Post a Comment