saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.1k stars 5.47k forks source link

jinja template copying file but not replacing tags #32375

Closed truescotw closed 6 years ago

truescotw commented 8 years ago

Hi, I was hoping someone could help me out, I have been struggling with getting a jinja template to work in my environment. I started off with a config file with some jinja variables in it which didnt work so pared it all back to the simplest configuration that i could but still no luck, I have tried restarting minion and master, re-installing the minion and everything else that i can think of , i am using 2015.8.3 on both the master(centos 7) and minion (windows 2012), the config and logs are below

salt master centos 7 salt 2015.8.3 (Beryllium) salt minion windows 2012 salt 2015.8.3 (Beryllium)

/srv/salt/base/trayport/jinjatest.sls

D:\myjinjatest.xml:
  file.managed:
    - source: salt://win/repo_ng/configs/mytest.jinja
    - template: jinja

/srv/salt/base/top.sls

  'trayport_ds_tst':
    - match: nodegroup
    - trayport.jinjatest

/salt-repositories/base/win/repo_ng/configs/mytest.jinja

------------------------------------------------------------------------------
Welcome to {{ grains['fqdn'] }}

Server Stats at a Glance:
------------------------

OS: {{ grains['osfullname'] }}
Kernel: {{ grains['kernelrelease'] }}
Memory: {{ grains['mem_total'] }} MB

This server is managed using a configuration management system (saltstack.org).
Changes made to this box directly will likely be over-written by SALT. Instead
modify server configuration via the configuration management git repository.
------------------------------------------------------------------------------

d:\myjinjatest.xml

------------------------------------------------------------------------------
Welcome to {{ grains['fqdn'] }}

Server Stats at a Glance:
------------------------

OS: {{ grains['osfullname'] }}
Kernel: {{ grains['kernelrelease'] }}
Memory: {{ grains['mem_total'] }} MB

This server is managed using a configuration management system (saltstack.org).
Changes made to this box directly will likely be over-written by SALT. Instead
modify server configuration via the configuration management git repository.
------------------------------------------------------------------------------

Minion Log File

2016-04-06 00:28:00,932 [salt.utils.verify][WARNING ][4684] Insecure logging configuration detected! Sensitive data may be logged.
2016-04-06 00:28:00,932 [salt.cli.daemons ][INFO    ][4684] Setting up the Salt Minion "schtdst0863.mydomain.com"
2016-04-06 00:28:02,197 [salt.utils.process][DEBUG   ][4684] Created pidfile: c:\salt\var\run\salt-minion.pid
2016-04-06 00:28:02,197 [salt.config      ][DEBUG   ][4684] Reading configuration from c:\salt\conf\minion
2016-04-06 00:28:03,775 [salt.cli.daemons ][INFO    ][4684] The salt minion is starting up
2016-04-06 00:28:03,775 [salt.minion      ][INFO    ][4684] Minion is starting as user 'myuser'
2016-04-06 00:28:03,791 [salt.utils.event ][DEBUG   ][4684] AsyncEventPublisher PUB socket URI: tcp://127.0.0.1:4510
2016-04-06 00:28:03,791 [salt.utils.event ][DEBUG   ][4684] AsyncEventPublisher PULL socket URI: tcp://127.0.0.1:4511
2016-04-06 00:28:03,791 [salt.utils.event ][INFO    ][4684] Starting pub socket on tcp://127.0.0.1:4510
2016-04-06 00:28:03,791 [salt.utils.event ][INFO    ][4684] Starting pull socket on tcp://127.0.0.1:4511
2016-04-06 00:28:03,791 [salt.minion      ][DEBUG   ][4684] Minion 'schtdst0863.mydomain.com' trying to tune in
2016-04-06 00:28:03,791 [salt.minion      ][DEBUG   ][4684] sync_connect_master
2016-04-06 00:28:03,885 [salt.crypt       ][DEBUG   ][4684] Initializing new SAuth for ('c:\\salt\\conf\\pki\\minion', 'schtdst0863.mydomain.com', 'tcp://10.224.1.116:4506')
2016-04-06 00:28:03,916 [salt.transport.zeromq][DEBUG   ][4684] Generated random reconnect delay between '1000ms' and '11000ms' (7690)
2016-04-06 00:28:03,916 [salt.transport.zeromq][DEBUG   ][4684] Setting zmq_reconnect_ivl to '7690ms'
2016-04-06 00:28:03,916 [salt.transport.zeromq][DEBUG   ][4684] Setting zmq_reconnect_ivl_max to '11000ms'
2016-04-06 00:28:03,932 [salt.transport.zeromq][DEBUG   ][4684] Initializing new AsyncZeroMQReqChannel for ('c:\\salt\\conf\\pki\\minion', 'schtdst0863.mydomain.com', 'tcp://10.224.1.116:4506', 'clear')
2016-04-06 00:28:04,041 [salt.crypt       ][DEBUG   ][4684] Decrypting the current master AES key
2016-04-06 00:28:04,041 [salt.crypt       ][DEBUG   ][4684] Loaded minion key: c:\salt\conf\pki\minion\minion.pem
2016-04-06 00:28:04,135 [salt.crypt       ][DEBUG   ][4684] Loaded minion key: c:\salt\conf\pki\minion\minion.pem
2016-04-06 00:28:05,150 [salt.transport.zeromq][DEBUG   ][4684] Initializing new AsyncZeroMQReqChannel for ('c:\\salt\\conf\\pki\\minion', 'schtdst0863.mydomain.com', 'tcp://10.224.1.116:4506', 'aes')
2016-04-06 00:28:05,150 [salt.crypt       ][DEBUG   ][4684] Re-using SAuth for ('c:\\salt\\conf\\pki\\minion', 'schtdst0863.mydomain.com', 'tcp://10.224.1.116:4506')
2016-04-06 00:28:05,494 [salt.crypt       ][DEBUG   ][4684] Loaded minion key: c:\salt\conf\pki\minion\minion.pem
2016-04-06 00:28:05,525 [salt.config      ][DEBUG   ][4684] Reading configuration from c:\salt\conf\minion
2016-04-06 00:28:06,775 [salt.utils.lazy  ][DEBUG   ][4684] LazyLoaded timezone.get_offset
2016-04-06 00:28:06,775 [salt.utils.lazy  ][DEBUG   ][4684] LazyLoaded cmd.run
2016-04-06 00:28:06,791 [salt.loaded.int.module.cmdmod][INFO    ][4684] Executing command ['tzutil', '/g'] in directory 'C:\\Users\\myuser'
2016-04-06 00:28:06,806 [salt.loaded.int.module.cmdmod][DEBUG   ][4684] output: W. Europe Standard Time
2016-04-06 00:28:06,806 [salt.loaded.int.module.cmdmod][INFO    ][4684] Executing command ['tzutil', '/l'] in directory 'C:\\Users\\myuser'
2016-04-06 00:28:06,869 [salt.loaded.int.module.cmdmod][DEBUG   ][4684] output: (UTC-12:00) International Date Line West 
Dateline Standard Time

(UTC-11:00) Coordinated Universal Time-11 
UTC-11

(UTC-10:00) Hawaii 
Hawaiian Standard Time

(UTC-09:00) Alaska 
Alaskan Standard Time

(UTC-08:00) Baja California 
Pacific Standard Time (Mexico)

(UTC-08:00) Pacific Time (US & Canada) 
Pacific Standard Time

(UTC-07:00) Arizona 
US Mountain Standard Time

(UTC-07:00) Chihuahua, La Paz, Mazatlan 
Mountain Standard Time (Mexico)

(UTC-07:00) Mountain Time (US & Canada) 
Mountain Standard Time

(UTC-06:00) Central America 
Central America Standard Time

(UTC-06:00) Central Time (US & Canada) 
Central Standard Time

(UTC-06:00) Guadalajara, Mexico City, Monterrey 
Central Standard Time (Mexico)

(UTC-06:00) Saskatchewan 
Canada Central Standard Time

(UTC-05:00) Bogota, Lima, Quito, Rio Branco 
SA Pacific Standard Time

(UTC-05:00) Chetumal 
Eastern Standard Time (Mexico)

(UTC-05:00) Eastern Time (US & Canada) 
Eastern Standard Time

(UTC-05:00) Indiana (East) 
US Eastern Standard Time

(UTC-04:30) Caracas 
Venezuela Standard Time

(UTC-04:00) Asuncion 
Paraguay Standard Time

(UTC-04:00) Atlantic Time (Canada) 
Atlantic Standard Time

(UTC-04:00) Cuiaba 
Central Brazilian Standard Time

(UTC-04:00) Georgetown, La Paz, Manaus, San Juan 
SA Western Standard Time

(UTC-03:30) Newfoundland 
Newfoundland Standard Time

(UTC-03:00) Brasilia 
E. South America Standard Time

(UTC-03:00) Buenos Aires 
Argentina Standard Time

(UTC-03:00) Cayenne, Fortaleza 
SA Eastern Standard Time

(UTC-03:00) Greenland 
Greenland Standard Time

(UTC-03:00) Montevideo 
Montevideo Standard Time

(UTC-03:00) Salvador 
Bahia Standard Time

(UTC-03:00) Santiago 
Pacific SA Standard Time

(UTC-02:00) Coordinated Universal Time-02 
UTC-02

(UTC-01:00) Azores 
Azores Standard Time

(UTC-01:00) Cabo Verde Is. 
Cape Verde Standard Time

(UTC) Casablanca 
Morocco Standard Time

(UTC) Coordinated Universal Time 
UTC

(UTC) Dublin, Edinburgh, Lisbon, London 
GMT Standard Time

(UTC) Monrovia, Reykjavik 
Greenwich Standard Time

(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna 
W. Europe Standard Time

(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague 
Central Europe Standard Time

(UTC+01:00) Brussels, Copenhagen, Madrid, Paris 
Romance Standard Time

(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb 
Central European Standard Time

(UTC+01:00) West Central Africa 
W. Central Africa Standard Time

(UTC+01:00) Windhoek 
Namibia Standard Time

(UTC+02:00) Amman 
Jordan Standard Time

(UTC+02:00) Athens, Bucharest 
GTB Standard Time

(UTC+02:00) Beirut 
Middle East Standard Time

(UTC+02:00) Cairo 
Egypt Standard Time

(UTC+02:00) Damascus 
Syria Standard Time

(UTC+02:00) E. Europe 
E. Europe Standard Time

(UTC+02:00) Harare, Pretoria 
South Africa Standard Time

(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius 
FLE Standard Time

(UTC+02:00) Istanbul 
Turkey Standard Time

(UTC+02:00) Jerusalem 
Israel Standard Time

(UTC+02:00) Kaliningrad (RTZ 1) 
Kaliningrad Standard Time

(UTC+02:00) Tripoli 
Libya Standard Time

(UTC+03:00) Baghdad 
Arabic Standard Time

(UTC+03:00) Kuwait, Riyadh 
Arab Standard Time

(UTC+03:00) Minsk 
Belarus Standard Time

(UTC+03:00) Moscow, St. Petersburg, Volgograd (RTZ 2) 
Russian Standard Time

(UTC+03:00) Nairobi 
E. Africa Standard Time

(UTC+03:30) Tehran 
Iran Standard Time

(UTC+04:00) Abu Dhabi, Muscat 
Arabian Standard Time

(UTC+04:00) Baku 
Azerbaijan Standard Time

(UTC+04:00) Izhevsk, Samara (RTZ 3) 
Russia Time Zone 3

(UTC+04:00) Port Louis 
Mauritius Standard Time

(UTC+04:00) Tbilisi 
Georgian Standard Time

(UTC+04:00) Yerevan 
Caucasus Standard Time

(UTC+04:30) Kabul 
Afghanistan Standard Time

(UTC+05:00) Ashgabat, Tashkent 
West Asia Standard Time

(UTC+05:00) Ekaterinburg (RTZ 4) 
Ekaterinburg Standard Time

(UTC+05:00) Islamabad, Karachi 
Pakistan Standard Time

(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi 
India Standard Time

(UTC+05:30) Sri Jayawardenepura 
Sri Lanka Standard Time

(UTC+05:45) Kathmandu 
Nepal Standard Time

(UTC+06:00) Astana 
Central Asia Standard Time

(UTC+06:00) Dhaka 
Bangladesh Standard Time

(UTC+06:00) Novosibirsk (RTZ 5) 
N. Central Asia Standard Time

(UTC+06:30) Yangon (Rangoon) 
Myanmar Standard Time

(UTC+07:00) Bangkok, Hanoi, Jakarta 
SE Asia Standard Time

(UTC+07:00) Krasnoyarsk (RTZ 6) 
North Asia Standard Time

(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi 
China Standard Time

(UTC+08:00) Irkutsk (RTZ 7) 
North Asia East Standard Time

(UTC+08:00) Kuala Lumpur, Singapore 
Singapore Standard Time

(UTC+08:00) Perth 
W. Australia Standard Time

(UTC+08:00) Taipei 
Taipei Standard Time

(UTC+08:00) Ulaanbaatar 
Ulaanbaatar Standard Time

(UTC+09:00) Osaka, Sapporo, Tokyo 
Tokyo Standard Time

(UTC+09:00) Seoul 
Korea Standard Time

(UTC+09:00) Yakutsk (RTZ 8) 
Yakutsk Standard Time

(UTC+09:30) Adelaide 
Cen. Australia Standard Time

(UTC+09:30) Darwin 
AUS Central Standard Time

(UTC+10:00) Brisbane 
E. Australia Standard Time

(UTC+10:00) Canberra, Melbourne, Sydney 
AUS Eastern Standard Time

(UTC+10:00) Guam, Port Moresby 
West Pacific Standard Time

(UTC+10:00) Hobart 
Tasmania Standard Time

(UTC+10:00) Magadan 
Magadan Standard Time

(UTC+10:00) Vladivostok, Magadan (RTZ 9) 
Vladivostok Standard Time

(UTC+11:00) Chokurdakh (RTZ 10) 
Russia Time Zone 10

(UTC+11:00) Solomon Is., New Caledonia 
Central Pacific Standard Time

(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky (RTZ 11) 
Russia Time Zone 11

(UTC+12:00) Auckland, Wellington 
New Zealand Standard Time

(UTC+12:00) Coordinated Universal Time+12 
UTC+12

(UTC+12:00) Fiji 
Fiji Standard Time

(UTC+13:00) Nuku'alofa 
Tonga Standard Time

(UTC+13:00) Samoa 
Samoa Standard Time

(UTC+14:00) Kiritimati Island 
Line Islands Standard Time
2016-04-06 00:28:06,931 [salt.utils.lazy  ][DEBUG   ][4684] LazyLoaded config.merge
2016-04-06 00:28:06,931 [salt.utils.lazy  ][DEBUG   ][4684] LazyLoaded mine.update
2016-04-06 00:28:06,931 [salt.minion      ][INFO    ][4684] Added mine.update to scheduler
2016-04-06 00:28:06,931 [salt.utils.schedule][INFO    ][4684] Added new job __mine_interval to scheduler
2016-04-06 00:28:06,931 [salt.utils.event ][DEBUG   ][4684] SaltEvent PUB socket URI: tcp://127.0.0.1:4510
2016-04-06 00:28:06,931 [salt.utils.event ][DEBUG   ][4684] SaltEvent PULL socket URI: tcp://127.0.0.1:4511
2016-04-06 00:28:06,931 [salt.utils.event ][DEBUG   ][4684] Sending event - data = {'_stamp': '2016-04-05T22:28:06.931000', 'complete': True, 'schedule': {'__mine_interval': {'function': 'mine.update', 'jid_include': True, 'minutes': 60, 'maxrunning': 2}}}
2016-04-06 00:28:06,931 [salt.utils.schedule][DEBUG   ][4684] Persisting schedule
2016-04-06 00:28:06,931 [salt.utils.schedule][ERROR   ][4684] Failed to persist the updated schedule
2016-04-06 00:28:06,978 [salt.minion      ][DEBUG   ][4684] Handling event '/salt/minion/minion_schedule_add_complete\n\n\x83\xa6_stamp\xba2016-04-05T22:28:06.931000\xa8complete\xc3\xa8schedule\x81\xaf__mine_interval\x84\xa8function\xabmine.update\xabjid_include\xc3\xa7minutes<\xaamaxrunning\x02'
2016-04-06 00:28:06,978 [salt.transport.zeromq][DEBUG   ][4684] Initializing new AsyncZeroMQReqChannel for ('c:\\salt\\conf\\pki\\minion', 'schtdst0863.mydomain.com', 'tcp://10.224.1.116:4506', 'aes')
2016-04-06 00:28:06,978 [salt.crypt       ][DEBUG   ][4684] Initializing new SAuth for ('c:\\salt\\conf\\pki\\minion', 'schtdst0863.mydomain.com', 'tcp://10.224.1.116:4506')
2016-04-06 00:28:06,994 [salt.transport.zeromq][DEBUG   ][4684] Initializing new AsyncZeroMQReqChannel for ('c:\\salt\\conf\\pki\\minion', 'schtdst0863.mydomain.com', 'tcp://10.224.1.116:4506', 'aes')
2016-04-06 00:28:07,010 [salt.crypt       ][DEBUG   ][4684] Initializing new SAuth for ('c:\\salt\\conf\\pki\\minion', 'schtdst0863.mydomain.com', 'tcp://10.224.1.116:4506')
2016-04-06 00:28:07,025 [salt.minion      ][INFO    ][4684] Minion is ready to receive requests!
2016-04-06 00:28:08,025 [salt.utils.schedule][INFO    ][4684] Running scheduled job: __mine_interval
2016-04-06 00:28:08,025 [salt.utils.schedule][DEBUG   ][4684] schedule: This job was scheduled with jid_include, adding to cache (jid_include defaults to True)
2016-04-06 00:28:08,025 [salt.utils.schedule][DEBUG   ][4684] schedule: This job was scheduled with a max number of 2
2016-04-06 00:28:10,525 [salt.minion      ][DEBUG   ][4684] Handling event '_minion_mine\n\n\x85\xa5clear\xc2\xa3cmd\xa5_mine\xa4data\x80\xa2id\xda\x00#schtdst0863.mydomain.com\xa6_stamp\xba2016-04-05T22:28:09.775000'
2016-04-06 00:28:10,525 [salt.transport.zeromq][DEBUG   ][4684] Initializing new AsyncZeroMQReqChannel for ('c:\\salt\\conf\\pki\\minion', 'schtdst0863.mydomain.com', 'tcp://10.224.1.116:4506', 'aes')
2016-04-06 00:28:10,541 [salt.crypt       ][DEBUG   ][4684] Initializing new SAuth for ('c:\\salt\\conf\\pki\\minion', 'schtdst0863.mydomain.com', 'tcp://10.224.1.116:4506')
2016-04-06 00:28:33,775 [salt.minion      ][INFO    ][4684] User myuser Executing command state.highstate with jid 20160406002833786143
2016-04-06 00:28:33,775 [salt.minion      ][DEBUG   ][4684] Command details {'tgt_type': 'glob', 'jid': '20160406002833786143', 'tgt': 'schtdst0863.mydomain.com', 'ret': '', 'user': 'myuser', 'arg': [], 'fun': 'state.highstate'}
2016-04-06 00:28:39 [salt.minion    ][INFO    ] Starting a new job with PID 5168
2016-04-06 00:28:51 [salt.state     ][INFO    ] Loading fresh modules for state activity
2016-04-06 00:28:51 [salt.template  ][ERROR   ] Template was specified incorrectly: False
2016-04-06 00:28:51 [salt.template  ][ERROR   ] Template was specified incorrectly: False
2016-04-06 00:28:51 [salt.fileclient][INFO    ] Fetching file from saltenv 'base', ** skipped ** latest already in cache u'salt://top.sls'
2016-04-06 00:28:51 [salt.template  ][ERROR   ] Template was specified incorrectly: False
2016-04-06 00:28:52 [salt.loaded.int.module.saltutil][INFO    ] Creating module dir 'c:\\salt\\var\\cache\\salt\\minion\\extmods\\beacons'
2016-04-06 00:28:52 [salt.loaded.int.module.saltutil][INFO    ] Syncing beacons for environment 'base'
2016-04-06 00:28:52 [salt.loaded.int.module.saltutil][INFO    ] Loading cache from salt://_beacons, for base)
2016-04-06 00:28:52 [salt.fileclient][INFO    ] Caching directory u'_beacons/' for environment 'base'
2016-04-06 00:28:54 [salt.loaded.int.module.saltutil][INFO    ] Creating module dir 'c:\\salt\\var\\cache\\salt\\minion\\extmods\\modules'
2016-04-06 00:28:54 [salt.loaded.int.module.saltutil][INFO    ] Syncing modules for environment 'base'
2016-04-06 00:28:54 [salt.loaded.int.module.saltutil][INFO    ] Loading cache from salt://_modules, for base)
2016-04-06 00:28:54 [salt.fileclient][INFO    ] Caching directory u'_modules/' for environment 'base'
2016-04-06 00:28:56 [salt.loaded.int.module.saltutil][INFO    ] Creating module dir 'c:\\salt\\var\\cache\\salt\\minion\\extmods\\states'
2016-04-06 00:28:56 [salt.loaded.int.module.saltutil][INFO    ] Syncing states for environment 'base'
2016-04-06 00:28:56 [salt.loaded.int.module.saltutil][INFO    ] Loading cache from salt://_states, for base)
2016-04-06 00:28:56 [salt.fileclient][INFO    ] Caching directory u'_states/' for environment 'base'
2016-04-06 00:28:57 [salt.loaded.int.module.saltutil][INFO    ] Creating module dir 'c:\\salt\\var\\cache\\salt\\minion\\extmods\\sdb'
2016-04-06 00:28:57 [salt.loaded.int.module.saltutil][INFO    ] Syncing sdb for environment 'base'
2016-04-06 00:28:57 [salt.loaded.int.module.saltutil][INFO    ] Loading cache from salt://_sdb, for base)
2016-04-06 00:28:57 [salt.fileclient][INFO    ] Caching directory u'_sdb/' for environment 'base'
2016-04-06 00:28:59 [salt.loaded.int.module.saltutil][INFO    ] Creating module dir 'c:\\salt\\var\\cache\\salt\\minion\\extmods\\grains'
2016-04-06 00:28:59 [salt.loaded.int.module.saltutil][INFO    ] Syncing grains for environment 'base'
2016-04-06 00:28:59 [salt.loaded.int.module.saltutil][INFO    ] Loading cache from salt://_grains, for base)
2016-04-06 00:28:59 [salt.fileclient][INFO    ] Caching directory u'_grains/' for environment 'base'
2016-04-06 00:29:01 [salt.loaded.int.module.saltutil][INFO    ] Creating module dir 'c:\\salt\\var\\cache\\salt\\minion\\extmods\\renderers'
2016-04-06 00:29:01 [salt.loaded.int.module.saltutil][INFO    ] Syncing renderers for environment 'base'
2016-04-06 00:29:01 [salt.loaded.int.module.saltutil][INFO    ] Loading cache from salt://_renderers, for base)
2016-04-06 00:29:01 [salt.fileclient][INFO    ] Caching directory u'_renderers/' for environment 'base'
2016-04-06 00:29:03 [salt.loaded.int.module.saltutil][INFO    ] Creating module dir 'c:\\salt\\var\\cache\\salt\\minion\\extmods\\returners'
2016-04-06 00:29:03 [salt.loaded.int.module.saltutil][INFO    ] Syncing returners for environment 'base'
2016-04-06 00:29:03 [salt.loaded.int.module.saltutil][INFO    ] Loading cache from salt://_returners, for base)
2016-04-06 00:29:03 [salt.fileclient][INFO    ] Caching directory u'_returners/' for environment 'base'
2016-04-06 00:29:05 [salt.loaded.int.module.saltutil][INFO    ] Creating module dir 'c:\\salt\\var\\cache\\salt\\minion\\extmods\\output'
2016-04-06 00:29:05 [salt.loaded.int.module.saltutil][INFO    ] Syncing output for environment 'base'
2016-04-06 00:29:05 [salt.loaded.int.module.saltutil][INFO    ] Loading cache from salt://_output, for base)
2016-04-06 00:29:05 [salt.fileclient][INFO    ] Caching directory u'_output/' for environment 'base'
2016-04-06 00:29:06 [salt.loaded.int.module.saltutil][INFO    ] Creating module dir 'c:\\salt\\var\\cache\\salt\\minion\\extmods\\utils'
2016-04-06 00:29:06 [salt.loaded.int.module.saltutil][INFO    ] Syncing utils for environment 'base'
2016-04-06 00:29:06 [salt.loaded.int.module.saltutil][INFO    ] Loading cache from salt://_utils, for base)
2016-04-06 00:29:06 [salt.fileclient][INFO    ] Caching directory u'_utils/' for environment 'base'
2016-04-06 00:29:08 [salt.loaded.int.module.saltutil][INFO    ] Creating module dir 'c:\\salt\\var\\cache\\salt\\minion\\extmods\\log_handlers'
2016-04-06 00:29:08 [salt.loaded.int.module.saltutil][INFO    ] Syncing log_handlers for environment 'base'
2016-04-06 00:29:08 [salt.loaded.int.module.saltutil][INFO    ] Loading cache from salt://_log_handlers, for base)
2016-04-06 00:29:08 [salt.fileclient][INFO    ] Caching directory u'_log_handlers/' for environment 'base'
2016-04-06 00:29:10 [salt.loaded.int.module.saltutil][INFO    ] Creating module dir 'c:\\salt\\var\\cache\\salt\\minion\\extmods\\proxy'
2016-04-06 00:29:10 [salt.loaded.int.module.saltutil][INFO    ] Syncing proxy for environment 'base'
2016-04-06 00:29:10 [salt.loaded.int.module.saltutil][INFO    ] Loading cache from salt://_proxy, for base)
2016-04-06 00:29:10 [salt.fileclient][INFO    ] Caching directory u'_proxy/' for environment 'base'
2016-04-06 00:29:12 [salt.state     ][INFO    ] Loading fresh modules for state activity
2016-04-06 00:29:12,103 [salt.minion      ][DEBUG   ][4684] Handling event 'module_refresh\n\n\x81\xa6_stamp\xba2016-04-05T22:29:12.087000'
2016-04-06 00:29:12,103 [salt.minion      ][DEBUG   ][4684] Refreshing modules. Notify=False
2016-04-06 00:29:12,103 [salt.config      ][DEBUG   ][4684] Reading configuration from c:\salt\conf\minion
2016-04-06 00:29:12 [salt.fileclient][INFO    ] Fetching file from saltenv 'base', ** skipped ** latest already in cache u'salt://groups/init.sls'
2016-04-06 00:29:12 [salt.fileclient][INFO    ] Fetching file from saltenv 'base', ** skipped ** latest already in cache u'salt://users/init.sls'
2016-04-06 00:29:12 [salt.fileclient][INFO    ] Fetching file from saltenv 'base', ** skipped ** latest already in cache u'salt://trayport/jinjatest.sls'
2016-04-06 00:29:12 [salt.state     ][INFO    ] Running state [c:\temp\salt_managed.txt] at time 00:29:12.306000
2016-04-06 00:29:12 [salt.state     ][INFO    ] Executing state file.managed for c:\temp\salt_managed.txt
2016-04-06 00:29:12 [salt.loaded.int.states.file][WARNING ] Neither 'source' nor 'contents' nor 'contents_pillar' nor 'contents_grains' was defined, yet 'replace' was set to 'True'. As there is no source to replace the file with, 'replace' has been set to 'False' to avoid reading the file unnecessarily
2016-04-06 00:29:12 [salt.state     ][INFO    ] File c:\temp\salt_managed.txt exists with proper permissions. No changes made.
2016-04-06 00:29:12 [salt.state     ][INFO    ] Completed state [c:\temp\salt_managed.txt] at time 00:29:12.353000
2016-04-06 00:29:12 [salt.state     ][INFO    ] Running state [D:\myjinjatest.xml] at time 00:29:12.353000
2016-04-06 00:29:12 [salt.state     ][INFO    ] Executing state file.managed for D:\myjinjatest.xml
2016-04-06 00:29:12 [salt.fileclient][INFO    ] Fetching file from saltenv 'base', ** skipped ** latest already in cache u'salt://win/repo_ng/trayport/trayport_ds/HEAD/configs/Nuon/mytest.jinja'
2016-04-06 00:29:12 [salt.state     ][INFO    ] File changed:
New file
2016-04-06 00:29:12 [salt.state     ][INFO    ] Completed state [D:\myjinjatest.xml] at time 00:29:12.494000
2016-04-06 00:29:12 [salt.minion    ][INFO    ] Returning information for job: 20160406002833786143
2016-04-06 00:29:13,619 [salt.utils.lazy  ][DEBUG   ][4684] LazyLoaded config.merge
2016-04-06 00:29:13,619 [salt.utils.lazy  ][DEBUG   ][4684] LazyLoaded mine.update
jfindlay commented 8 years ago

@truescotw, thanks for reporting. I have tried a simplified case, which works for me. I am also not using windows, so that may be relevant.

jmoney-main ~ master # tree /srv
/srv
├── pillar
└── salt
    ├── envs
    │   ├── master_syndic_minion
    │   │   └── init.sls
    │   └── programmatic_tests
    ├── master
    ├── minion
    ├── motd.jinja
    ├── repo
    └── test.sls

5 directories, 6 files
jmoney-main ~ master # cat /srv/salt/test.sls
/tmp/motd.xml:
  file.managed:
    - source: salt://motd.jinja
    - template: jinja
jmoney-main ~ master # cat /srv/salt/motd.jinja
------------------------------------------------------------------------------
Welcome to {{ grains['fqdn'] }}

Server Stats at a Glance:
------------------------

OS: {{ grains['osfullname'] }}
Kernel: {{ grains['kernelrelease'] }}
Memory: {{ grains['mem_total'] }} MB

This server is managed using a configuration management system (saltstack.org).
Changes made to this box directly will likely be over-written by SALT. Instead
modify server configuration via the configuration management git repository.
------------------------------------------------------------------------------
jmoney-main ~ master # salt jmoney-main state.apply test
jmoney-main:
----------
          ID: /tmp/motd.xml
    Function: file.managed
      Result: True
     Comment: File /tmp/motd.xml updated
     Started: 10:56:51.270322
    Duration: 24.413 ms
     Changes:
              ----------
              diff:
                  New file
              mode:
                  0644

Summary for jmoney-main
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
jmoney-main ~ master # cat /tmp/motd.xml
------------------------------------------------------------------------------
Welcome to jmoney-main

Server Stats at a Glance:
------------------------

OS: Debian
Kernel: 3.16.0-4-amd64
Memory: 2004 MB

This server is managed using a configuration management system (saltstack.org).
Changes made to this box directly will likely be over-written by SALT. Instead
modify server configuration via the configuration management git repository.
------------------------------------------------------------------------------
jmoney-main ~ master # salt jmoney-main test.versions
jmoney-main:
    Salt Version:
               Salt: 2015.8.7

    Dependency Versions:
             Jinja2: 2.7.3
           M2Crypto: 0.21.1
               Mako: 1.0.0
             PyYAML: 3.11
              PyZMQ: 14.4.0
             Python: 2.7.9 (default, Mar  1 2015, 12:57:24)
               RAET: Not Installed
            Tornado: 4.2.1
                ZMQ: 4.0.5
               cffi: 0.8.6
           cherrypy: Not Installed
           dateutil: Not Installed
              gitdb: 0.5.4
          gitpython: 0.3.2 RC1
              ioflo: Not Installed
            libgit2: Not Installed
            libnacl: Not Installed
       msgpack-pure: Not Installed
     msgpack-python: 0.4.2
       mysql-python: Not Installed
          pycparser: 2.10
           pycrypto: 2.6.1
             pygit2: Not Installed
       python-gnupg: Not Installed
              smmap: 0.8.2
            timelib: Not Installed

    System Versions:
               dist: debian 8.4
            machine: x86_64
            release: 3.16.0-4-amd64
             system: debian 8.4
truescotw commented 8 years ago

Hi jfindlay, i actually managed to get this working bit i am a little bit unsure how it happened. I recreated the template file this time in Linux as appoased to in notepad++ on windows and then it started to work again, i suspect that this may have been caused because of something like line endings or text formatting, if it helps at all i have attached the actual file that i was using (providing of course the upload doesnt change it :) ) but from my side i have a solution and will know to create the file on the salt master in the future if i come across this issue

truescotw commented 8 years ago

i have another update, the xml file that i need to generate must be in "UCS-2 Little endian encoding" but saltstack does not seam to support this encoding in a jinja template, is there any way around this?

jfindlay commented 8 years ago

@truescotw, I am glad you figured it out, but salt should be able to work with windows encodings and line endings, etc. if necessary, so let's keep this open so we can track down what may be happening with that. I suspect there may be a jinja error somewhere that is getting ignored.

truescotw commented 8 years ago

we read in one of the .py files that currently the jinja templates only support utf-8 and theres a #to be fixed comment in the file about it. I have a pretty ugly workaround in place for the minute which works but is not ideal. (i will find the py file i am talking about and add it to this ticket)

D:\myjinjatest.xml:
  file.managed:
    - source: salt://win/repo_ng/configs/mytest.jinja
    - template: jinja
    - saltenv: 'base'

change-encoding:
  cmd.run:
    - name: 'start powershell "(Get-Content -Encoding UTF8 D:\myjinjatest.xml ) | Out-File -Encoding Unicode D:\myjinjatest.xml"'
    - order: last
jfindlay commented 8 years ago

@truescotw, what might be done here is to add an encoding argument to file.managed and other functions in that module that would also be sensible.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.