lib/pvcglue/packages/manager.rb in pvcglue-0.9.4 vs lib/pvcglue/packages/manager.rb in pvcglue-0.9.5
- old
+ new
@@ -80,11 +80,11 @@
def push_configuration
raise('Not supported for local manager') if Pvcglue.command_line_options[:cloud_manager_override]
test_data = File.read(::Pvcglue.cloud.local_file_name)
- TOML.parse(test_data) # At least make sure it's valid TOML
+ ::SafeMash.new(TOML.parse(test_data)) # At least make sure it's valid TOML and that we can load it in
# TODO: More in-depth validations
connection.upload_file(user_name, ::Pvcglue.cloud.local_file_name, ::Pvcglue::Manager.manager_file_name, nil, nil, '600')
git_commit!
@@ -92,11 +92,13 @@
# TODO: Turn delete back on
# File.delete(::Pvcglue.cloud.local_file_name)
end
def git_commit!
- connection.ssh!(user_name, '', %Q(cd #{manager_dir} && git add -A && git commit --allow-empty --author="pvc-$PVCGLUE_USER <>" -m "Change configuration"))
+ # connection.ssh!(user_name, '', %Q(cd #{manager_dir} && git add -A && git commit --allow-empty --author="pvc-$PVCGLUE_USER <>" -m "Change configuration")) # Will not work as $PVCGLUE_USER is in the local context here
+ connection.ssh!(user_name, '', %Q(cd #{manager_dir} && git add -A && git commit --allow-empty --author="pvc-\\$PVCGLUE_USER <>" -m "Change configuration")) # It's all about context!
+ # connection.ssh!(user_name, '', %Q(cd #{manager_dir} && git add -A && git commit --allow-empty --author="pvc-\\`printenv PVCGLUE_USER\\` <>" -m "Change configuration")) # Another way that works...for future reference
end
def working_directory_clean?
connection.run_get_stdout!(user_name, '', %Q(cd #{manager_dir} && git status)) =~ /working directory clean/
end
@@ -105,9 +107,10 @@
new.pull_configuration
# new(Pvcglue.cloud.manager_minion).pull_configuration
end
def pull_configuration
+ # ssh REMOTE "sh -c \"(nohup sleep 30; touch nohup-exit) > /dev/null &\""
# TODO: Rename to edit_config_start, and create Thor commands to match
if connection.file_exists?(user_name, ::Pvcglue::Manager.manager_file_name)
data = connection.read_from_file(user_name, ::Pvcglue::Manager.manager_file_name)
else
template = Tilt.new(Pvcglue.template_file_name('pvc_manager.toml.erb'))