modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
| 9 ++++-----
modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
| 6 ++----
2 files changed, 6 insertions(+), 9 deletions(-)
New commits:
commit d9e02aa86cd9b4a560a214c93f49cd21fed11bd1
Author: Shannon Hughes <shughes(a)fred.hughes.lan>
Date: Thu Jan 28 22:08:37 2010 -0500
fixing augeas and cobber due to RawConfig refactoring
diff --git
a/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
b/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
index 272fffb..dd900cf 100644
---
a/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
+++
b/modules/plugins/augeas/src/main/java/org/rhq/plugins/augeas/helper/AugeasRawConfigHelper.java
@@ -82,7 +82,7 @@ public class AugeasRawConfigHelper {
aug.save();
toUpdate.setPath(existingConfig.getPath());
- toUpdate.setContents(FileUtils.readFileToByteArray(new File(file)));
+ toUpdate.setContents(FileUtils.readFileToString(new File(file)));
} finally {
if (aug != null) {
aug.close();
@@ -111,18 +111,17 @@ public class AugeasRawConfigHelper {
public void save(RawConfiguration config) throws Exception {
File f = new File(config.getPath());
- FileUtils.writeStringToFile(f, normalizeToUnix(config.getContents()));
+ FileUtils.writeStringToFile(f, config.getContents());
}
private String getFile(Augeas aug) {
return aug.get(transformPrefix + "/incl");
}
- private Augeas createAugeas(String lens, byte[] binary) throws Exception {
+ private Augeas createAugeas(String lens, String contents) throws Exception {
Augeas aug = new Augeas(rootPath, loadPath, Augeas.NO_MODL_AUTOLOAD);
File fl = File.createTempFile("_rhq", null);
- String contents = normalizeToUnix(binary);
- //write the 'to' file to disk
+ //write the 'to' file to disk
FileUtils.writeStringToFile(fl, contents);
aug.set(transformPrefix + "/lens", lens);
aug.set(transformPrefix + "/incl", fl.getAbsolutePath());
diff --git
a/modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
b/modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
index c0bb0c5..3e80c01 100644
--- a/modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
+++ b/modules/plugins/cobbler/src/main/java/org/rhq/plugins/cobbler/CobblerComponent.java
@@ -123,12 +123,12 @@ public class CobblerComponent extends AugeasConfigurationComponent
implements Au
Set<RawConfiguration> configs = new HashSet<RawConfiguration>();
RawConfiguration modules = new RawConfiguration();
modules.setPath(MODULES_PATH);
- modules.setContents(FileUtils.readFileToByteArray(new File(MODULES_PATH)));
+ modules.setContents(FileUtils.readFileToString(new File(MODULES_PATH)));
configs.add(modules);
RawConfiguration settings = new RawConfiguration();
settings.setPath(SETTINGS_PATH);
- settings.setContents(FileUtils.readFileToByteArray(new
File(SETTINGS_PATH)));
+ settings.setContents(FileUtils.readFileToString(new File(SETTINGS_PATH)));
configs.add(settings);
return configs;
} catch (Exception e) {
@@ -187,7 +187,6 @@ public class CobblerComponent extends AugeasConfigurationComponent
implements Au
// TODO Auto-generated method stub
}
- @Override
public Property createProperty(String propName, String augeasPath, Augeas aug) {
if ("settings/manage_dhcp".equals(propName) ||
"settings/manage_dns".equals(propName)) {
return new PropertySimple(propName,
"1".equals(aug.get(augeasPath)));
@@ -195,7 +194,6 @@ public class CobblerComponent extends AugeasConfigurationComponent
implements Au
return new PropertySimple(propName, aug.get(augeasPath));
}
- @Override
public String getPropertyValue(String propName, Configuration from) {
if ("settings/manage_dhcp".equals(propName) ||
"settings/manage_dns".equals(propName)) {
PropertySimple prop = (PropertySimple) from.get(propName);
Show replies by date